Answer a question

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?

Answers

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.

Logo

华为、百度、京东云现已入驻,来创建你的专属开发者社区吧!

更多推荐