020 555 1111
  • Old fashion, modular, procedural PHP plus some scaffolding techniques to allow it to mimic MVC simplicity.
  • A quick reference to help you find in PHP maze what needs to be done and how to do it.
  • Learn a PHP Object Oriented Programming by building a live discussion forum application.
  • MVC - Model View Controller - real life, easy reference and application.
This product has options, take a look at them and select ones you like the most.
Options are displayed under image section.

seconds to time format v.2
[php functions]

// seconds to time format: output:  00 hr 02 min 36 sec 
//if hr=0 no show, if min=0 no show
function jp_sec2hms ($sec, $padHours = false) 
  {
    // holds formatted string
    $hms = "";
    
    // there are 3600 seconds in an hour, so if we
    // divide total seconds by 3600 and throw away
    // the remainder, we've got the number of hours
    $hours = intval(intval($sec) / 3600); 

    // add to $hms, with a leading 0 if asked for
    if ($hours!=0) $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ' hr ' : $hours. ' hr';
     
    // dividing the total seconds by 60 will give us
    // the number of minutes, but we're interested in 
    // minutes past the hour: to get that, we need to 
    // divide by 60 again and keep the remainder
    $minutes = intval(($sec / 60) % 60); 

    // then add to $hms (with a leading 0 if needed)
    if ($minutes!=0) $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ' min ';

    // seconds are simple - just divide the total
    // seconds by 60 and keep the remainder
    $seconds = intval($sec % 60); 

    // add to $hms, again with a leading 0 if needed
    $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT).' sec';

    // done!
    return $hms;
    
  }