in PhpMyAdmin (OVH Mutu), a table with column type timestamp. Impossible to put into this colum a timestamp : Always display datetime like 2017-01-09 23:02:01 !!! It generate several problmes : default current_timestamp give in this table "0000-00-00 00:00:00". Calculate delays is impossible. The only way : define a int(11) type column. An idea ?...

1 Answer 1


If you need to calculate with the timestamp field, you simply may use SELECT UNIX_TIMESTAMP(yourtimestampfield);. I decided to use this instead of the int(11) because of the built in function on update CURRENT_TIMESTAMP which shows this format 0000-00-00 00:00:00.

Also inside of mysql queries yo may use it the reverse way like UPDATE user SET logouttime = FROM_UNIXTIME(UNIX_TIMESTAMP(logintime)+3600) WHERE user_id = 12345;

Hope this helps.

  • 1
    Many thanks for help. But why my TIMESTAMP column do not give a TIMESTAMP ? In my mind a TIMESTAMP colum give Timestamp, and a DATETIME column give a DATETIME ?! Very curiuous for me...
    – JMB
    Jan 10, 2017 at 8:49
  • Because a Unix timestamp is different than a SQL database timestamp. Mar 31, 2018 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.