note 58018 rejected from function.strtotime by betz
| From: | betz@php.net | Date: | Fri, 21 Oct 2005 16:19:02 +0000 |
| Subject: | note 58018 rejected from function.strtotime by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97365@lists.php.net to get a copy of this message | ||
Note Submitter: JustinB at harvest dot org
----
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.