RE: [PHP] hello everybody - date problem -
| From: | Ford, Mike [LSS] | Date: | Thu, 26 Sep 2002 15:36:31 +0000 |
| Subject: | RE: [PHP] hello everybody - date problem - | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117742@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Christoph Siefer [mailto:siefer@sym.net]
> Sent: 26 September 2002 16:16
>
> I expecting
>
> <?php
>
> $timestamp = ($now - $five_minutes_ago);
> print date(H:i:s, $timestamp);
>
> ?>
>
> to print something like "00:05:00".
>
> The two given timstamps, differing (e.g.) five minutes, wich is 300
> seconds, print this instead: "01:05:00".
> Whatever I try, the result always is an hour to much.
This looks like it might be a time-zone issue, as I'd guess being in Germany you're 1 hour
different from GMT. Let's see: $timestamp should contain 300, which equates to 00:05:00
01-Jan-1970 GMT -- but if you're 1 hour ahead of GMT, date will compensate for this and return
01:05:00 01-Jan-1970 in your local timezone.
Try using gmdate instead, which does not do any timezone compensation.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211