Page 1 of 1

Convert seconds to time in php

Posted: Wed Dec 02, 2009 10:14 pm
by valmerin
Ok i grabbed the server time, it gives me seconds in a unix time stamp i think. But i took the end time i wanted - current server time and i get a smaller string of seconds. But im having trouble convertering it to a time. I dont want a date and time i just want to convert it to dd:hh:mm:ss.

Could some one give me some insight on how to go about doing this pls. Thank you for your help.

Re: Convert seconds to time in php

Posted: Wed Dec 02, 2009 10:32 pm
by AlanG
Use the php date function to format unix timestamps.

Code: Select all

$unixTime = 1234567890;
 
$myTime = date('d:H:i:s', $unixTime);

Re: Convert seconds to time in php

Posted: Thu Dec 03, 2009 1:07 pm
by valmerin
Ty vm that was exactly what i needed