I got working times type is second.How can I convert 6010 second to 0 day ,0 hour ,10 min ,10 second in php?
Asked
Active
Viewed 2,887 times
0

user2439722
- 39
- 1
- 8
2 Answers
1
You will want an integer division technique.
days = seconds / ( 24 * 60 * 60 )
seconds -= ( days * ( 24 * 60 * 60 ) )
hours = seconds / ( 60 * 60 )
seconds -= ( hours * ( 60 * 60 ) )
minutes = seconds / 60
seconds -= ( minutes * 60 )
Implementing this in PHP should be trivial.

PP.
- 10,764
- 7
- 45
- 59
1
Try this.
$hours = floor($seconds / 3600);
$mins = floor(($seconds - ($hours*3600)) / 60);

Amar Banerjee
- 4,992
- 5
- 34
- 51
-
1why not include link where you got it from? http://stackoverflow.com/questions/3856293/how-to-convert-seconds-to-time-format – Kyslik Jun 12 '13 at 14:03