How does one convert seconds (or milliseconds) to a timestamp (or just a string that looks like a date) in mySql

后端 未结 4 689
南笙
南笙 2021-01-18 03:35

I\'m looking at this documentation http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_maketime And I KNOW I must be missing it, but I just don\'t s

4条回答
  •  难免孤独
    2021-01-18 04:06

    Check out FROM_UNIXTIME. That converts the number of seconds since midnight Jaunuary 1, 1970 into a timestamp.

    If you have the time in seconds since midnight of your current day, then use the MAKETIME function.

    MAKETIME( seconds / (60*60),
              seconds / 60,
              seconds % 60 )
    

提交回复
热议问题