#37514 [Asn]: strtotime doesn't assume year correctly

From: Date: Fri, 19 May 2006 07:12:35 +0000
Subject: #37514 [Asn]: strtotime doesn't assume year correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97355@lists.php.net to get a copy of this message
ID: 37514 Updated by: derick@php.net Reported By: pcavit at gmail dot com Status: Assigned Bug Type: Date/time related Operating System: FreeBSD 6 PHP Version: 5.1.4 Assigned To: derick New Comment: Definitely not a bug... in PHP 4 not even the first one works actually. That doesn't mean we can't have a look if we can add support for this format though. Previous Comments: ------------------------------------------------------------------------ [2006-05-19 01:59:36] judas dot iscariote at gmail dot com This seems to be the expected behaviour, as it returns -1 on PHP4.4.3-dev,4.3,6 , and false in PHP 5.2-dev.however im not sure it is the "desired" behaviour..;-) ------------------------------------------------------------------------ [2006-05-18 22:43:03] pcavit at gmail dot com Description: ------------ When using strtotime to parse dates if an 'am' or 'pm' is added without specifying a year false will be returned. Reproduce code: --------------- echo date('r', strtotime('May 18th 5:05')); echo date('r', strtotime('May 18th 5:05pm')); echo date('r', strtotime('May 18th 5:05 pm')); echo date('r', strtotime('May 18th 5:05am')); echo date('r', strtotime('May 18th 5:05 am')); echo date('r', strtotime('May 18th 2006 5:05pm')); Expected result: ---------------- Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Actual result: -------------- Thu, 18 May 2006 05:05:00 -0700 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Thu, 18 May 2006 17:05:00 -0700 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37514&edit=1

« previous php.bugs (#97355) next »