Hi,
I have a script that is returning a time in a number of seconds eg 218 seconds.
Is there a function in PHP,(im sure there will be) that will change say 69 seconds, to 01:09?
Thanks in advance
Number of seconds to minutes and seconds
Moderator: General Moderators
-
ianripping
- Forum Newbie
- Posts: 17
- Joined: Thu Feb 05, 2004 3:20 am
- Location: Leeds, UK
Doessuffice?
Code: Select all
<?php echo date('H:i:s', 218); ?>-
ianripping
- Forum Newbie
- Posts: 17
- Joined: Thu Feb 05, 2004 3:20 am
- Location: Leeds, UK
This print 01:03:38 - why is the hour 01? it should be 00volka wrote:Doessuffice?Code: Select all
<?php echo date('H:i:s', 218); ?>
oh sorry, date() takes the server's timezone into account.
00:00:00 1970 GMT was 01:00:00 1970 in your timezone.prints 00:03:38
00:00:00 1970 GMT was 01:00:00 1970 in your timezone.
Code: Select all
<?php echo gmdate('H:i:s', 218); ?>-
ianripping
- Forum Newbie
- Posts: 17
- Joined: Thu Feb 05, 2004 3:20 am
- Location: Leeds, UK
Thanks, works greatvolka wrote:oh sorry, date() takes the server's timezone into account.
00:00:00 1970 GMT was 01:00:00 1970 in your timezone.prints 00:03:38Code: Select all
<?php echo gmdate('H:i:s', 218); ?>