How to convert time in seconds to HH:MM:SS format in MySQL?

前端 未结 4 1823
太阳男子
太阳男子 2020-12-10 12:40

I\'m having a data column named test_duration bigint(12). I\'m storing time in seconds into the database. Now when I fetch record from the table I want the

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 13:23

    There is a MYSQL function that transform seconds to the format "HH:MM:SS":

    SEC_TO_TIME(seconds)
    

    Example:

    SELECT SEC_TO_TIME(3661);
    

    will output:

    01:01:01

    Regards

提交回复
热议问题