Re: date() function and timestamps

From: Date: Fri, 04 Jul 2003 15:51:26 +0000
Subject: Re: date() function and timestamps
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154003@lists.php.net to get a copy of this message
On Jul 3, 2003, "Garrick Linn" claimed that: |Hello all, | |I seem to be running into a problem where the date() function appears not |to differentiate properly between unix timestamps. | |For example, the code: | |<?php | |$seconds = 1054278483; |echo "$seconds<br>"; |echo date("d-m-Y H:m:s", $seconds); |echo "<br><br>"; | |$seconds = ($seconds - 60); |echo "$seconds<br>"; |echo date("d-m-Y H:m:s", $seconds); |echo "<br><br>"; | |?> | |outputs | |1054278483 |30-05-2003 02:05:03 | |1054278423 |30-05-2003 02:05:03 | |I would expect the second date() to output 30-05-2003 02:04:03 as the |second timestamp is exactly 60 seconds behind the first, but I might be |missing something. I see the same behavior on two redhat linux machines |running Apache 2.0.40 + PHP 4.2.2 and Apache 1.3.26 + PHP 4.3.2 |respectively. Any ideas? | |Thanks, | |Garrick Linn | As has been pointed out before, you expect incorrectly. The value of 'm' won't change depending on what's around it. The correct formats are listed at http://www.php.net/manual/en/function.date.php Jeff -- Registered Linux user #304026. "lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import" Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855.

« previous php.general (#154003) next »