I'm hosting my system on a server that is in the USA.
DateTime.Now returns the US date and time.
I would like you to return the date and time in Brazil. It's possible?
You need to convert to the desired timezone, like this:
TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("E. South America Standard Time"))
See working in .NET Fiddle . Also posted on GitHub for future reference . Note that it is hosted in another country but configures the server with universal time. It doesn't matter in this case because the conversion is done based on local time considering the zone that is actually being used.
I don't think so, but see if you have a more suitable time zone for you.
You can create a method to get local time:
public DateTime PegaHoraBrasilia() => TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("E. South America Standard Time"));
Name what you think is most appropriate. And call this method whenever you want
DateTime.Now in Brasilia time.