转换为utc时间 - 节省时间 [英] convert to utc time - day light saving time

查看:88
本文介绍了转换为utc时间 - 节省时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





使用.UtcNow将日期时间转换为通用时间,因为在服务器中将日间照明时间设置为true,日期时间将转换为通用时间与日间节省时间的差异。

我需要转换时间与日间节能差异。我怎么能这样做?



提前谢谢

Jiju

Hi

when converting a datetime to universal time using .UtcNow, because of day light saving time is set to true in server, the date time is converts to universal time with day light saving time difference.
I need to convert the time with out day light saving difference. how can I do this?

thanks in advance
Jiju

推荐答案

DateTime convertedDate = DateTime.Parse(date);

DateTime localDate = convertedDate.ToLocalTime();
DateTime convertedDate = DateTime.Parse(date);
DateTime localDate = convertedDate.ToLocalTime();


检查是否可以使用 TimeZoneInfo [ ^ ]。 AdjustmentRule 阵列 [ ^ ],将为您提供有关DST设置和偏移的信息。
Check if you can use the TimeZoneInfo class[^]. The AdjustmentRule array[^], will give you information on the DST settings as well as the offset.


这篇关于转换为utc时间 - 节省时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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