显示相应的国家/地区当前日期 [英] Display respective country current date time

查看:93
本文介绍了显示相应的国家/地区当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有需要。就像我在diff中打开我的网站一样。然后它应该显示国家日期时间。



ex。

如果我在美国打开我的网站,那么它应该显示美国约会时间,如果在澳大利亚开放则应显示澳大利亚的约会时间等。



注意:许多国家/地区有多个时区。



提前感谢。

Hi all,

i have req. like if i open my website in diff. countries then it should show that country date time.

ex.
if i open my website in USA then it should show USA date time, if open in Australia then it should show Australia date time and so on.

Note: many countries have more than one time zone.

thanks in advance.

推荐答案

var remoteTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
var remoteTime = TimeZoneInfo.ConvertTime(DateTime.Now, remoteTimeZone);
Console.WriteLine("Time in {0} is {1}", remoteTimeZone.Id, remoteTime.TimeOfDay.ToString());


您好,



尝试这些:



http ://forums.asp.net/t/1897688.aspx/1?datetime + for + different + countries + [ ^ ]


这篇关于显示相应的国家/地区当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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