how to convert EST to Other Times Zones(PST/CST/MST) considering Daylight savings C#.NET

£可爱£侵袭症+ 提交于 2019-12-13 09:44:23

问题


I have an application in which I am displaying time fields in EST, I need to convert them to respective time zones , DAYLIGHT saving need to be considered.

How can I change to different time zone provided I have EST time and Time Zone to which it needs to get converted

I have to consider Daylight saving On/Off and have to apply Off set.. how can I > any working examples..

Example : I want to convert 3:15 PM which is in EST , needs to be converted to PST


回答1:


I would recommend using DateTimeOffset to make sure that your DaylightSaving is always right. You can also Convert the DateTimeOffset to different time zone with the TimeZoneInfo.ConvertTime static method of the TimeZoneInfo class.



来源:https://stackoverflow.com/questions/18134202/how-to-convert-est-to-other-times-zonespst-cst-mst-considering-daylight-saving

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!