note 94423 deleted from function.strtotime by peehaa
| From: | peehaa@php.net | Date: | Fri, 06 Jan 2017 16:03:57 +0000 |
| Subject: | note 94423 deleted from function.strtotime by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208729@lists.php.net to get a copy of this message | ||
Note Submitter: Leon F.
----
I needed to generate timestamps for specific days of the week in a month (e.g. the 2nd wednesday or
the 3rd friday). After messing about with different syntax, I found this works pretty consistently:
<?php
strtotime('+0 week sun nov 2009'); // first sunday in nov 2009
strtotime('+1 week sun nov 2009'); // second sunday
strtotime('-1 week sun nov 2009'); // last sunday in oct 2009
?>
This is helping me considerably in parsing ical spec's RRULE sets for example.