How do I say what is the current UTC in eastern zo

2020-05-07 03:39发布

问题:

No matter what server is being used, I want a way to be able to just get the Eastern UTC time. All my timestamps in the system is setup for est, but my Azure server is set to UTC, but my local dev box and staging site is on est. What is the best way? Thanks for any help.

var estZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var utcTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now, estZone);

回答1:

UTC is UTC. It is the same everywhere.