#28562 [Bgs->Opn]: Strtotime() or Date() Imroper Handling of time
| From: | aksuska at esoteritech dot com | Date: | Sun, 30 May 2004 19:22:36 +0000 |
| Subject: | #28562 [Bgs->Opn]: Strtotime() or Date() Imroper Handling of time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60164@lists.php.net to get a copy of this message | ||
ID: 28562
User updated by: aksuska at esoteritech dot com
Reported By: aksuska at esoteritech dot com
-Status: Bogus
+Status: Open
Bug Type: Date/time related
Operating System: Linux 2.4.25 (RH)
PHP Version: 4.3.4
New Comment:
It might help if you look at my examples more closely.
There is no 5 hour discrepancy anywhere.There is a 3
minute, 5 minute, and 22 minute discrepancy. I can't see
how this can be due to a time zone variance.
Previous Comments:
------------------------------------------------------------------------
[2004-05-30 19:49:43] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
When you don't specify the time, the timezone information
is used, hence the extra 5 hours.
------------------------------------------------------------------------
[2004-05-28 19:51:57] aksuska at esoteritech dot com
Description:
------------
Time values are (IMHO) calculated incorrectly from
strtotime(), or as passed through date(). See example
below.
Config:
---------------------------
'./configure' '--prefix=/usr/local/' '--with-apxs=/etc/
httpd/bin/apxs' '--disable-cgi' '--enable-versioning' '--
enable-pic' '--disable-posix-threads' '--enable-memory-
limit' '--with-pear=/usr/local/lib/php' '--with-openssl=/
usr/local/ssl' '--disable-debug' '--enable-magic-quotes' '-
-disable-rpath' '--with-bz2=/usr' '--with-zlib' '--enable-
bcmath' '--enable-calendar' '--enable-ftp' '--enable-exif'
'--with-curl=/usr' '--enable-dba' '--with-gdbm=/usr' '--
with-flatfile' '--with-inifile' '--enable-dbase' '--with-
gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--
with-png-dir=/usr' '--with-freetype-dir=/usr' '--with-
gettext=/usr' '--with-gmp' '--with-imap=/usr/local' '--
with-imap-ssl=/usr/local/ssl' '--enable-mbstring' '--
enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt=/
usr' '--with-mhash=/usr' '--with-unixODBC=/usr/local/
unixODBC' '--with-mysql=/usr/local/mysql' '--enable-
sockets' '--with-regex=system' '--enable-wddx' '--with-
expat-dir=/usr' '--enable-xslt' '--with-xslt-sablot=/usr'
'--enable-inline-optimization' '--with-pspell=/usr/local'
----------------
php.ini diff:
-------------------
I can't provide this as the server isn't mine. I canb,
however, provide a phpinfo() output on request.
--------------------
Reproduce code:
---------------
<?
$date = '3/31/04';
print date( 'Y-m-d H:m:s', strtotime( $date ) ) . "<BR>";
$date = date( 'm/d/y', time() );
print date( 'Y-m-d H:m:s', strtotime( $date ) ) . " ($date)<BR>";
$date = '03/31/04 00:00:00';
print date( 'Y-m-d H:m:s', strtotime( $date ) ) . "<BR>";
$date = '03/31/04 03:25:19';
print date( 'Y-m-d H:m:s', strtotime( $date ) ) . "<BR>";
?>
Expected result:
----------------
2004-03-31 00:00:00
2004-05-28 00:00:00 (05/28/04)
2004-03-31 00:00:00
2004-03-31 03:25:19
Actual result:
--------------
2004-03-31 00:03:00
2004-05-28 00:05:00 (05/28/04)
2004-03-31 00:03:00
2004-03-31 03:03:19
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28562&edit=1