[英]How to get Time zone name from DateTime.Now
How to get time zone name(eg: Europe/London, Asia/Kolkata, etc.) from DateTime.Now() in c#如何从 c# 中的DateTime.Now()获取时区名称(例如:欧洲/伦敦、亚洲/加尔各答等)
Please help me请帮我
Thanks, King谢谢大王
DateTime.Now() returns current computer localtime. DateTime.Now() 返回当前计算机本地时间。
If you want get current computer timezone, read this:如果您想获取当前计算机时区,请阅读以下内容:
https://docs.microsoft.com/en-us/dotnet/api/system.timezone.currenttimezone?view=net-5.0 https://docs.microsoft.com/en-us/dotnet/api/system.timezone.currenttimezone?view=net-5.0
You can't get zone using DateTime.Now()您无法使用 DateTime.Now() 获取区域
The below piece of code gives you the daylight time and standard time.下面的代码为您提供了白天时间和标准时间。
TimeZone localZone = TimeZone.CurrentTimeZone;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.