note 105784 added to datetime.formats.relative
| From: | matt at osu1 dot php dot net | Date: | Wed, 14 Sep 2011 21:23:41 +0000 |
| Subject: | note 105784 added to datetime.formats.relative | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183171@lists.php.net to get a copy of this message | ||
My previous note was incorrect in a few cases. I apologize for not testing this thoroughly. It seems
as if replacing "of" with '1st' is not good enough and, actually, the right
(possibly only better) way to go about it is a little bit more complex. What actually needs to be
done is the following:
If the ordinal being used is "last" and the next month is n, use the "n 1".
Otherwise, if the previous month is p and it has d number of days in it, use "p d".
For example: "last thursday of November" becomes "last thursday December 1" and
"fourth thursday of November" becomes "fourth thursday September 30th"
Hopes this helps someone out there.
----
Server IP: 69.147.83.197
Probable Submitter: 151.138.254.21
----
Manual Page -- http://www.php.net/manual/en/datetime.formats.relative.php
Edit -- https://master.php.net/note/edit/105784
Del: integrated -- https://master.php.net/note/delete/105784/integrated
Del: useless -- https://master.php.net/note/delete/105784/useless
Del: bad code -- https://master.php.net/note/delete/105784/bad+code
Del: spam -- https://master.php.net/note/delete/105784/spam
Del: non-english -- https://master.php.net/note/delete/105784/non-english
Del: in docs -- https://master.php.net/note/delete/105784/in+docs
Del: other reasons-- https://master.php.net/note/delete/105784
Reject -- https://master.php.net/note/reject/105784
Search -- https://master.php.net/manage/user-notes.php