var a=DateTimeOffset.UtcNow; var b=DateTimeOffset.Now; a.Dump("Utc时间"); a.LocalDateTime.Dump("转本地时间,去掉时区"); b.Dump("当前时间"); b.ToOffset(new TimeSpan(1,0,0)).Dump("utc时间加时区"); b.UtcDateTime.Dump("当前时间转utc时间去掉时区");
输出
var a=DateTimeOffset.UtcNow; var b=DateTimeOffset.Now; a.Dump("Utc时间"); a.LocalDateTime.Dump("转本地时间,去掉时区"); b.Dump("当前时间"); b.ToOffset(new TimeSpan(1,0,0)).Dump("utc时间加时区"); b.UtcDateTime.Dump("当前时间转utc时间去掉时区");
输出