bluesmoon – Handling Date/Times and timezones

  • Always store time in UTC
  • Convert to local time on display (local being defined by the user looking at the data)
  • When storing a timezone, you need the name, timestamp and the offset. This is required because governments sometimes change the meanings of their timezones (eg: the US govt changed DST dates), and your application needs to handle things gracefully… eg: The exact timestamp when episodes of LOST showed both before and after DST rules changed.

via bluesmoon – Handling Date/Times and timezones. The three basic rules of storing date/times in a web application.

Justin Yost is a full-time Software Engineer and a part time educator. A graduate of Texas Tech University with a bachelor's degree in computer science, Justin relishes programming and learning more about anything and everything. When not working, Justin occasionally gives talks at the local PHP Meetup. In his free time, Justin enjoys backpacking and reading science fiction books.

Tagged with: , , , , , , ,
Posted in Programming, Quick Posts
Short Link: https://justinyost.com?p=1363

Leave a Reply

Your email address will not be published. Required fields are marked *

*