note 70173 deleted from function.strtotime by crell
| From: | crell@php.net | Date: | Thu, 30 Jun 2022 20:10:47 +0000 |
| Subject: | note 70173 deleted from function.strtotime by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218803@lists.php.net to get a copy of this message | ||
Note Submitter: sgutauckis
----
The following might produce something different than you might expect:
<?php
echo date('l, F jS Y', strtotime("third wednesday",
strtotime("2006-11-01"))) . "<br>";
echo date('l, F jS Y', strtotime("third sunday",
strtotime("2006-01-01")));
?>
Produces:
Wednesday, November 22nd 2006
Sunday, January 22nd 2006
The problem stems from strtotime when the requested day falls on the date passed to strtotime. If
you look at your calendar you will see that they should return:
Wednesday, November 15th 2006
Sunday, January 15th 2006
Because the date falls on the day requested it skips that day.