C# GMT 和 UTC 一样吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14986043/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 13:40:14  来源:igfitidea点击:

Is GMT same as UTC?

c#javascriptasp.netc#-4.0timezone

提问by Shiva Pareek

I am running a world targeted website where people from all over the world visit. The database contains time in International Date Line West format. I am taking the user time zone using JavaScript and converting the time in the database to user's time and then showing on the page. I want to ask that is International Date Line West is correct format for world level website? Or setting to UTC or GMT will be better? And what is the difference between UTC and GMT and International Date Line West? Are these three same? Finally what time should I set onto my server that will be converted using offset of timezone of user?

我正在运行一个面向世界的网站,来自世界各地的人们访问该网站。该数据库包含国际日期变更线西格式的时间。我正在使用 JavaScript 获取用户时区并将数据库中的时间转换为用户的时间,然后显示在页面上。我想问一下国际日期变更线西是世界级网站的正确格式吗?或者设置为UTC或GMT会更好?UTC 和 GMT 以及国际日期变更线西有什么区别?这三个一样吗?最后,我应该在我的服务器上设置什么时间来使用用户时区的偏移量进行转换?

采纳答案by minopret

If you're interested in astronomical observations, for example of satellites such as GPS, or if you want to cite a technical standard (ITU-R TF.460-6), then you might care that we use UTC and that GMT no longer has a precise definition. Otherwise you probably consider GMT to be the same thing as UTC, and also consider UT and UT1to be the same as UTC— which technically they are not.

如果您对天文观测感兴趣,例如GPS卫星,或者您想引用技术标准 ( ITU-R TF.460-6),那么您可能会关心我们使用 UTC 并且不再使用 GMT有准确的定义。否则,您可能认为 GMT 与 UTC 相同,并且还认为UT 和 UT1UTC相同——从技术上讲它们不是。

Also, if you're tracking computer criminals or other distributed activity, then you need to determine whether certain events at various sites may or may not have occurred before certain other events. For that purpose you will want to learn and use Network Time Protocol (NTP). That will have a much bigger effect on your understanding of time than the little differences between UTC, UT1, and UT.

此外,如果您正在跟踪计算机犯罪或其他分布式活动,那么您需要确定各个站点的某些事件是否在某些其他事件之前发生过。为此,您需要学习和使用网络时间协议 (NTP)。与 UTC、UT1 和 UT 之间的微小差异相比,这对您理解时间的影响要大得多。

"International Date LineWest" is just a friendly name for a timezone where the time is defined as twelve hours less than UTC (that is, UTC-12).

国际日期变更线西”只是一个时区的友好名称,该时区的时间定义为比 UTC 少 12 小时(即 UTC-12)。

回答by mattmanser

UTC is effectively the new name for GMT. It has very minor differences, but none that will impact you in that scenario.

UTC 实际上是 GMT 的新名称。它有非常小的差异,但在那种情况下不会影响您。

Servy's comment is completely wrong saying GMT includes daylight savings. That's a different timezone called BST that the UK moves to from GMT over summer.

Servy 的评论说 GMT 包括夏令时是完全错误的。这是一个不同的时区,称为 BST,英国在夏季从格林威治标准时间移至该时区。

回答by cernunnos

Usually when you have to present dates or times to people in different timezones what you should do is save all time information in UTC on your database and convert it to the users timezone on the display layer (when your presenting the information to your user)

通常,当您必须向不同时区的人显示日期或时间时,您应该做的是将所有时间信息以 UTC 格式保存在您的数据库中,并将其转换为显示层上的用户时区(当您向用户显示信息时)

However you will find a couple of challenges: - The timezone you get from javascript may not be trustworthy - Finding the location of the user through the IP and then getting the timezone is also not trustworthy

但是,您会发现一些挑战: - 您从 javascript 获得的时区可能不可信 - 通过 IP 查找用户的位置然后获取时区也不可信

A good approach in my opinion is to use a "best guess" to find the default timezone (javascript timezone should suffice) and give the user the ability to actively configure his timezone.

在我看来,一个好的方法是使用“最佳猜测”来找到默认时区(javascript 时区就足够了)并让用户能够主动配置他的时区。

On some google applications their approach is to prompt the user for his timezone before starting, this should be done only when you can guarantee that you don't have to repeat this every time the user visits your site (through user accounts or cookies)

在某些 google 应用程序中,他们的方法是在开始之前提示用户输入他的时区,只有当您可以保证不必在用户每次访问您的网站时(通过用户帐户或 cookie)重复此操作时,才应这样做