包含时区信息的场景下最好用DateTimeOffset吧。
DateTimeOffset.UtcNow.ToOffset(TimeSpan.FromHours(10))
哇,谢谢你老哥~
是的,FindSystemTimeZoneById 会和系统 挂钩
赞!完美的解决方法
//堪培拉,墨尔本,悉尼
TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");
DateTime easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);
var utc10Time = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "Tasmania Standard Time");