如何实现在Web应用程序时区? [英] How to implement timezone in a web application?
问题描述
我要实现我的web应用程序的时区。我研究,看到大多数Web应用程序使用GMT下拉列表中,这里是链接到下拉的http://www.attackwork.com/BlogEntry/6/Time-Zone-Dropdown-Select-List/Default.aspx
然后我看到这篇文章暗示UTC是当它涉及到实施时区的路要走。 http://aspnet.4guysfromrolla.com/articles/081507-1.aspx 基本上它的说法不使用 DateTime.Now 而不是使用 DateTime.UtcNow
我的问题是,
- 是否有UTC的时区的下拉列表中,像第一个环节我发现有一个在格林尼治标准时间?
- 我应该真正使用UTC或GMT?
.NET 3.5提供的的TimeZoneInfo 类,这应该让相对简单,为您填充时区下拉。格林尼治标准时间到来之前UTC与UTC 1月1日正式设立,1972年见此链接了解更多信息。对于今天的目的,两者是pretty多的代名词,尽管他们有着不同的历史渊源。无论使用何种外观和功能,更好地为您的目的。
I want to implement timezone in my web application. I researched and saw most web app use a GMT dropdown, here is the link to that dropdown http://www.attackwork.com/BlogEntry/6/Time-Zone-Dropdown-Select-List/Default.aspx
Then I saw this article suggesting UTC is the way to go when it comes to implement timezone. http://aspnet.4guysfromrolla.com/articles/081507-1.aspx Basically it's saying don't use DateTime.Now instead use DateTime.UtcNow
My questions are,
- Is there a dropdown of the timezones in UTC, like the first link I showed there is one on GMT?
- Should I really use UTC or GMT?
.NET 3.5 provides the TimeZoneInfo class which should make it relatively simple for you to populate a dropdown with time zones. GMT came before UTC and UTC was officially instituted on January 1, 1972. See this link for more information. For today's purposes, the two are pretty much synonymous, though they have different historical origins. Use whichever looks and functions better for your purposes.
这篇关于如何实现在Web应用程序时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!