38

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?

4

3 回答 3

32

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

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.

于 2013-02-20T17:25:15.303 回答
26

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 UT1 to be the same as UTC — which technically they are not.

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.

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

于 2013-02-20T17:32:17.270 回答
2

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)

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

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.

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)

于 2013-02-20T17:42:52.570 回答