Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
434 views
in Technique[技术] by (71.8m points)

mysql - Difference between timezones America/Los_Angeles and US/Pacific and PST8PDT?

I need to convert a bunch of dates in a MySQL database from Pacific time (America/Los_Angeles) to UTC. I found a great SO answer on how to do this.

During my tests and preparation, I'm finding that I'm getting the same time conversions when using any of the following time zone names:

  • America/Los_Angeles
  • US/Pacific
  • PST8PDT

So my questions are the following:

  • Are these all just aliases to the same thing? Or are there actual differences between them at some point in time?
  • If I want to provide a list of timezones to users on a website, would it be better to give them selections from the America group of names, or the US group of names?
question from:https://stackoverflow.com/questions/4309030/difference-between-timezones-america-los-angeles-and-us-pacific-and-pst8pdt

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

US/Pacific and PST8PDT both belong to the "other" timezones, which come with this warning:

Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.

They should all refer to the same timezone, compare:

http://www.travelmath.com/time-zone/PST8PDT
http://www.travelmath.com/time-zone/US/Pacific
http://www.travelmath.com/time-zone/America/Los_Angeles

As such, you should use America/Los_Angeles, which incidentally should also be a pretty "natural" and easy thing to select for users.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...