C#各时区时间互相转换

            DateTime utcTime0 = DateTime.UtcNow;
            DateTime utcTime1 = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now, TimeZoneInfo.Local);

            DateTime dateTime = DateTime.UtcNow;
            bool flag = TimeZoneInfo.FindSystemTimeZoneById("Iran Standard Time").IsDaylightSavingTime(dateTime);
            DateTime dateTime2 = TimeZoneInfo.ConvertTimeFromUtc(dateTime, TimeZoneInfo.FindSystemTimeZoneById("Iran Standard Time"));

 

你可能感兴趣的:(c#开发)