mysql - PHP Convert String to Duration -


using php, mysqli.

i selecting string mysql database , saving variable called $querytime, i'd modify how string displayed on screen. when print_r($querytime); see;

01:25:24

when var_dump($querytime) see;

string(8) "01:25:24"

is there way can display string in time duration format - like;

1 hour, 25 minutes, 24 seconds

presumably because database field stored varchar , not time-stamp things more complicated? unfortunately don't have access modify database.

any appreciated.

you simple work on string, if format same:

$querytime = '01:25:24';  $parts = explode(':', $querytime); $parts[0] .= ' hours'; $parts[1] .= ' minutes'; $parts[2] .= ' seconds';  //01 hours, 25 minutes, 24 seconds echo implode(', ', $parts); 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -