考虑到夏令时,如何将 EST 转换为其他时区(PST/CST/MST) C#.NET [英] how to convert EST to Other Times Zones(PST/CST/MST) considering Daylight savings C#.NET

查看:65
本文介绍了考虑到夏令时,如何将 EST 转换为其他时区(PST/CST/MST) C#.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我在其中显示 EST 中的时间字段,我需要将它们转换为各自的时区,需要考虑 DAYLIGHT 保存.

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.

如果我有需要转换到的 EST 时间和时区,我如何更改为不同的时区

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..

例如:我想转换美国东部时间下午 3:15,需要转换为 PST

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

推荐答案

我建议使用 DateTimeOffset 以确保您的夏令时始终正确.您还可以使用 TimeZoneInfo.ConvertTime 将 DateTimeOffset 转换为不同的时区TimeZoneInfo 类的静态方法.

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.

这篇关于考虑到夏令时,如何将 EST 转换为其他时区(PST/CST/MST) C#.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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