c#获取指定时区的日期

1、首先将服务器的时间转化为utc时间,然后转换成指定时区的日期

public DateTime GetSpecificZoneNowDate(string zoneName = "China Standard Time")
{
var utcdate = DateTime.Now.ToUniversalTime();
var beiJingZone = TimeZoneInfo.FindSystemTimeZoneById(zoneName);
return TimeZoneInfo.ConvertTimeFromUtc(utcdate, beiJingZone);
}

原文地址:https://www.cnblogs.com/taoshengyujiu/p/6011560.html