PHP Convert seconds to HH:MM:SS format

Profile picture for user Phil Frilling
By Phil Frilling, 4 January, 2017
A quick php snippet to convert seconds to HH:MM:SS


  $seconds = round($seconds);

  $output = sprintf('%02d:%02d:%02d', ($seconds/ 3600),($seconds/ 60 % 60), $seconds% 60);

Tags