What is the difference between datetime and timestamp in MySQL? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

What is the difference between datetime and timestamp in MySQL?

Damian99Damian99 USAPosts: 116Member
edited January 2014 in MySQL

Can someone please let me know what is the difference between datetime and timestamp in MySQL and how to use it properly?



  • DavidMDavidM USAPosts: 342Member
    edited February 2014

    in MySQL documentation it says,

    The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.


    The TIMESTAMP data type has a range of '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC. It has varying properties, depending on the MySQL version and the SQL mode the server is running in.

    There is a chance that you will go lower than the lower limit of the TIMESTAMP . Ex: for a record storing date of birth.

Sign In or Register to comment.