#40037 [Opn->Asn]: Incorrect output from strtotime, when timestr is used with a relative term this

From: Date: Thu, 11 Jan 2007 09:44:04 +0000
Subject: #40037 [Opn->Asn]: Incorrect output from strtotime, when timestr is used with a relative term this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107459@lists.php.net to get a copy of this message
ID: 40037 Updated by: tony2001@php.net Reported By: shruti224 at yahoo dot com -Status: Open +Status: Assigned Bug Type: Date/time related Operating System: ES4 PHP Version: 5.2.0 -Assigned To: +Assigned To: derick Previous Comments: ------------------------------------------------------------------------ [2007-01-05 19:39:02] shruti224 at yahoo dot com The following line in the sample script is used purely for demonstration purpose to give the idea to the developer of the test system's current time in UTC. print "now UTC from strtotime [" . strtotime("now UTC") . "]\n"; The bug occurs when strtotime is invoked with a pattern containing timestr and a relative term ("this Friday") in my example. ------------------------------------------------------------------------ [2007-01-05 19:30:19] shruti224 at yahoo dot com Description: ------------ Sample script to demonstrate the issue: <?php print "14:00:0 UTC this Friday [" . strtotime("14:00:0 UTC this Friday") . "]\n"; print "this Friday UTC [" . strtotime("this Friday UTC") . "]\n"; print "now UTC from strtotime [" . strtotime("now UTC") . "]\n"; ?> When I used this same script with : "PHP 5.0.5 (cli) (built: Oct 29 2006 22:42:15) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies" and my System's date being: # date Fri Jan 5 14:21:38 EST 2007 I got the correct desired output, which is as follows: 14:00:0 UTC this Friday [1168005600] this Friday UTC [1167955200] now UTC from strtotime [1168006899] After upgrading to PHP 5.2 "PHP 5.2.0 (cli) (built: Jan 2 2007 12:44:27) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies" and system's date now being # date Fri Jan 5 14:23:00 EST 2007 The same script as above generated the following incorrect output: 14:00:0 UTC this Friday [1167955200] this Friday UTC [1167955200] now UTC from strtotime [1168006981] By the look of it, it seems as if it ignores the time string completely. Please let me know, if I need to provide any further information. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40037&edit=1

« previous php.bugs (#107459) next »