note 94423 modified in function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Wed, 04 Nov 2009 15:02:56 +0000 |
| Subject: | note 94423 modified in function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162395@lists.php.net to get a copy of this message | ||
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:
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.
--was--
The docs for strtotime() are sorely lacking in what one's options are. 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:
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.
http://php.net/manual/en/function.strtotime.php