Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Konvertieren Sie Sekunden in Tage, Stunden, Minuten, Sekunden (MySQL)

select concat(
    format(floor(s / @day),0),
    'days ',
    time_format(sec_to_time(s % @day),'%Hh:%im:%ss') 
  ) formatted_date
from (select 1015557 s) t, (select @day = 3600 * 24);

produziert:

+--------------------+                                                                                                                               
| days               |                                                                                                                               
+--------------------+                                                                                                                               
| 11days 18h:05m:57s |                                                                                                                               
+--------------------+