将utc/gmt时间转换为本地时间

番茄系统家园 · 2021-07-03 12:59:23

将utc/gmt时间转换为本地时间

3回答

jeck猫

用于字符串,如2012-09-,nbsp;无法说明日期和时间来自哪个时区。有一个仁爱属性,它可以有三个时区选项之一:未指定本土化世界协调时注nbsp;如果您希望表示UTC或本地时区以外的日期/时间,则应使用所以对于你问题中的代码:;;=nbsp;();;kindnbsp;=nbsp;convertedDate.Kind;nbsp;//nbsp;willnbsp;equalnbsp;DateTimeKind.Unspecified你说你知道是哪种所以告诉它。DateTimenbsp;convertedDatenbsp;=nbsp;DateTime.SpecifyKind(nbsp;nbsp;nbsp;nbsp;DateTime.Parse(dateStr),nbsp;nbsp;nbsp;nbsp;DateTimeKind.Utc);varnbsp;kindnbsp;=nbsp;convertedDate.Kind;nbsp;//nbsp;willnbsp;equalnbsp;DateTimeKind.Utc现在,一旦系统知道它在协调世界时的时间,你可以只打电话。ToLocalTime:DateTimenbsp;dtnbsp;=nbsp;convertedDate.ToLocalTime();这将给你所需的结果。

相关阅读

  • win7怎么把utc改成gmt
  • 如何将我的时区更改为utc GMT
  • 将utc/gmt时间转换为本地时间
  • 免责声明: 凡标注转载/编译字样内容并非本站原创,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如果你觉得本文好,欢迎推荐给朋友阅读;本文链接: https://m.nndssk.com/post/6921.html。
    猜你喜欢
    最新应用
    热门应用