mysql sec_to_time 函数的作用与 time_to_sec 函数相反,sec_to_time 函数可以将秒数转换成时间,以当天 00:00:00 为基点。
mysql sec_to_time 函数介绍
sec_to_time:将秒数转换成时间。并以 hh:ii:ss 的时间格式进行输出!
语法:
sec_to_time(seconds);
参数:
seconds:传入的秒数,
注意:此函数是指将传入的秒数转换成距离当天00:00:00的时间,00:00:00为基数,为 0 秒。
mysql sec_to_time 函数示例
例1:
select sec_to_time(3600);
select sec_to_time(38600);
例2:
注意:如果输入的秒数过大,依然会以小时累加的形式展示。
select sec_to_time(386010);