Re: [PHP] date() function and timestamps
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: | |"; |echo date("d-m-Y H:m:s", $seconds); |echo ""; | |$seconds = ($seconds - 60); |echo "$seconds"; |echo date("d-m-Y H:m:s", $seconds); |echo ""; | |?> | |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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() function and timestamps
Doh! Gracias. :-) At 11:58 PM 7/3/2003 +, Philip Olson wrote: :) You are using an m where you want an i. Regards, Philip On Thu, 3 Jul 2003, Garrick Linn wrote: > 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: > > > $seconds = 1054278483; > echo "$seconds"; > echo date("d-m-Y H:m:s", $seconds); > echo ""; > > $seconds = ($seconds - 60); > echo "$seconds"; > echo date("d-m-Y H:m:s", $seconds); > echo ""; > > ?> > > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() function and timestamps
:) You are using an m where you want an i. Regards, Philip On Thu, 3 Jul 2003, Garrick Linn wrote: > 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: > > > $seconds = 1054278483; > echo "$seconds"; > echo date("d-m-Y H:m:s", $seconds); > echo ""; > > $seconds = ($seconds - 60); > echo "$seconds"; > echo date("d-m-Y H:m:s", $seconds); > echo ""; > > ?> > > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date() function and timestamps
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: $seconds = 1054278483; echo "$seconds"; echo date("d-m-Y H:m:s", $seconds); echo ""; $seconds = ($seconds - 60); echo "$seconds"; echo date("d-m-Y H:m:s", $seconds); echo ""; ?> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php