behz4d
behz4d

Reputation: 1849

storing date time in mysql

I used to store dates in MySQL using TIMESTAMP value (int 15), but after reading this:

http://derickrethans.nl/storing-date-time-in-database.html

I'm confused somehow! It's really important for me to be able to show the dates for users in different time zones, and all dates are before year 2038.

Whats the best way for storing date times into MySQL db while we want to manipulate the dates in different time zones?

(please first read the above article before sending any suggestions)

I would appreciate any kind of help

Upvotes: 0

Views: 166

Answers (1)

Sawant
Sawant

Reputation: 4536

This is what is suggested: Convert the dates to UTC first before storing them in the database as timestamp. Then, whenever you need to display them, just convert them on-the-fly to a user's timezone (with/without DST).

Upvotes: 2

Related Questions