note 94423 added to function.strtotime
| From: | LeonF dot at osu1 dot php dot net | Date: | Wed, 04 Nov 2009 02:58:19 +0000 |
| Subject: | note 94423 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162383@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 192.41.40.227
Probable Submitter: 66.91.123.81
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/94423
Del: integrated -- https://master.php.net/note/delete/94423/integrated
Del: useless -- https://master.php.net/note/delete/94423/useless
Del: bad code -- https://master.php.net/note/delete/94423/bad+code
Del: spam -- https://master.php.net/note/delete/94423/spam
Del: non-english -- https://master.php.net/note/delete/94423/non-english
Del: in docs -- https://master.php.net/note/delete/94423/in+docs
Del: other reasons-- https://master.php.net/note/delete/94423
Reject -- https://master.php.net/note/reject/94423
Search -- https://master.php.net/manage/user-notes.php