Skip navigation links

MySQL Forums :: General :: Storing timezone with datetime


Advanced Search

Re: Storing timezone with datetime
Posted by: Rick James ()
Date: June 27, 2009 12:55AM

Neither datatype stores the TZ explicitly.

TIMESTAMP is seconds since 1970, sitting in 4 bytes. It is stored in GMT. That is, the TZ offset is applied as you store a value, then reapplied when you fetch it. If you are storing and fetching from the same computer, you won't notice these two conversions.

DATETIME is an 8-byte string of digits "yyyymmddhhmmss". It is more like recording what the clock says, not what time it is in some global sense.

That's two ways of dealing with time. There are actually something like 5. You are on your own if the above two flavors of date+time don't do what you need.

Options: ReplyQuote


Subject Written By Posted
Storing timezone with datetime Robert Dodier 06/26/2009 12:38PM
Re: Storing timezone with datetime Peter Brawley 06/26/2009 04:26PM
Re: Storing timezone with datetime Robert Dodier 06/26/2009 05:50PM
Re: Storing timezone with datetime Peter Brawley 06/26/2009 07:14PM
Re: Storing timezone with datetime Rick James 06/27/2009 12:55AM
Re: Storing timezone with datetime Robert Dodier 06/29/2009 10:36AM
Re: Storing timezone with datetime Rick James 06/30/2009 12:15AM
Re: Storing timezone with datetime James Birchall 07/23/2009 11:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.