将DateTime.Now转换为GMT [英] Convert DateTime.Now To GMT

查看:129
本文介绍了将DateTime.Now转换为GMT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Convert DateTime.Now转换为GMT ...我在网上看到很多帖子都可以转换为UTC,但不能转换为GMT

How can i convert Convert DateTime.Now To GMT... I saw many posts in web to convert to UTC but not GMT

推荐答案

使用System.Core中找到的类;

为此,必须将DateTimeKind设置为DateTimeKind.Utc.

Use the TimeZoneInfo class found in System.Core;

You must set the DateTimeKindto DateTimeKind.Utc for this.

DateTime MyTime = new DateTime(1990, 12, 02, 19, 31, 30, DateTimeKind.Utc);

DateTime MyTimeInWesternEurope = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(MyTime, "W. Europe Standard Time");



请参考:在时区之间转换时间 [ C#:确保DateTime.Now返回GMT [ ^ ]



Please refer: Converting Times Between Time Zones[^]
also check similar discussion:C#: Making sure DateTime.Now returns a GMT[^]


UTC GMT.


阅读以下内容:
http://stackoverflow.com/questions/6677374/datetime-now-represented-as-gmt-pst服务器上的时间 [ http://stackoverflow.com/questions/1108644/c-making-sure-datetime-now-returns-a-gmt-1-time [
Read the following :
http://stackoverflow.com/questions/6677374/datetime-now-represented-as-gmt-time-on-a-pst-server[^]

http://stackoverflow.com/questions/1108644/c-making-sure-datetime-now-returns-a-gmt-1-time[^]


这篇关于将DateTime.Now转换为GMT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆