所以过去 4 个小时我一直在试图解决这个问题。 Windows Azure 上的 DateTime.Now 是 1/10/2013,而本地时间是 1/09/2013。我已经尝试了书中的所有内容来使其对齐,调用 DateTime.Now.ToLocalTime(),执行 UTC 但我仍然无法解决问题。
最佳答案
private DateTime ConvertToCentral()
{
DateTime timeUtc = DateTime.UtcNow;
TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
return cstTime;
}
关于azure - 与本地日期时间相比,Windows Azure DateTime 现已缩短 1 天,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14250669/