note 58018 added to function.strtotime

From: Date: Fri, 21 Oct 2005 16:16:01 +0000
Subject: note 58018 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-97362@lists.php.net to get a copy of this message
I found the following issue with a script that I had written to roll over a date at a certain time. For some reason, the strtotime function is skipping a week, but only as of today. Example: <?php // This block wrongly returns 2005-10-30 as of today, but returned 2005-10-23 as of yesterday. No server changes have been made. $write_date = (date('w') == 0 && date('Gi') < 2215) ? date('Y-m-d') : date('Y-m-d', strtotime('Next Sunday')); // This block correctly returns 2005-10-23. This is my temporary work-around until I can figure out why this is happening all of a sudden. $write_date = (date('w') == 0 && date('Gi') < 2215) ? date('Y-m-d') : date('Y-m-d', strtotime('Next Sunday', strtotime('Last Sunday'))); ?> This behavior has me baffled, but I thought that I would throw it out there for the rest of you who might be experiencing similar behavior. ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58018 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58018&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58018&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97362) next »