Best practice for storing Date/time in MySQL

I want to use the field type 'timestamp' since I have a 64-bit system, but MySQL documentation states that timestamps cannot go beyond 2038, is this true--even on a 64-bit system present-day?

I'd prefer to not use datetime as I will lose auto timezone conversions...

Please advise
MarkProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mayank GairolaSr. Application Support Engg.Commented:
Timestamp (both PHP ones and MySQL's ones) are stored using 32 bits (i.e. 4 bytes) integers ; which means they are limited to a date range that goes from 1970 to 2038.
DATETIME don't have that limitation -- but are stored using more bytes (8 bytes, if I'm not mistaken)

After, between storing timestamps as seen by PHP, or timestamps as seen by MySQL :
•      using PHP timestamps means manipulations are easier from PHP -- see http://fr.php.net/manual/en/ref.datetime.php
•      using MySQL's timestamps means manipulations are easier from MySQL -- see http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

And, for more informations between MySQL's TIMESTAMP and DATETIME datatypes, see http://dev.mysql.com/doc/refman/5.1/en/datetime.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarkProgrammerAuthor Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.