MySQL Forums
Forum List  »  General

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

Written By
Re: Storing timezone with datetime
June 27, 2009 12:55AM

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.