我项目上的日期问题 [英] Problem on date on my project
本文介绍了我项目上的日期问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已从印度境外购买了日期与印度日期不匹配的域名.
所以请帮我确定日期.
谢谢.
I have purchase the domain from Outside India where the date is not matching to indian date.
So Please help me how i will set my date.
Thanks.
推荐答案
这根本不是问题,因为从OS可以知道服务器本地时区.请参阅类System.TimeZoneInfo
, http://msdn.microsoft.com/en-us/library /system.timezoneinfo.aspx [ ^ ].
在客户端,可以从JavaScript API中了解时区,请参见 http://www.w3schools.com/jsref/jsref_gettimezoneoffset. asp [ ^ ].
我希望使用另一种方法:仅使用UTC时间在所有应用程序中进行所有计算,根据定义,该时间对于Globe上的任何地方都是相同的.使用System.DateTime.UtcNow
.当然,对于用户来说,使用他们的本地时间很方便.仅在需要以HTML显示时间的时候使用它;如上所述,使用JavaScript将UTC时间转换为本地时间.
就这样.
—SA
This is not a problem at all, because the server-local time zone is known from the OS. See the classSystem.TimeZoneInfo
, http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx[^].
On the client side, time zone is known from JavaScript API, see http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp[^].
I would prefer another approach: do all your calculations in all the application using only UTC time, which by definition is the same for any place on the Globe. UseSystem.DateTime.UtcNow
. Of course, for the users it''s convenient to use their local time. Use it only at the moment when you need to show time in HTML; convert UTC time to local time using JavaScript as I mentioned above.
That''s it.
—SA
这篇关于我项目上的日期问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文