|
Posted by Michael Fesser on 01/06/07 01:27
..oO(Moot)
>Agreed. strtotime has some annoying flaws that aren't officially
>documented. For an illustration, try the following code:
>[...]
>
>This example shows how strtotime's handling of months could really
>screw up logic expecting it to work in a different way than it actually
>does (I should know, I've learned it the hard way). Since there are 28
>days in Feb, strtotime adds the 3 extra days (to 31) and ends up at
>March 3rd, similar problem with April, which has 30 days, so the extra
>1 puts it to May 1st.
This behaviour is documented:
| The fuzz in units can cause problems with relative items. For example,
| `2003-07-31 -1 month' might evaluate to 2003-07-01, because 2003-06-31
| is an invalid date. To determine the previous month more reliably, you
| can ask for the month before the 15th of the current month. [...]
http://www.gnu.org/software/tar/manual/html_node/tar_115.html#SEC115
Micha
Navigation:
[Reply to this message]
|