Dawid Szalega wrote:
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cj**********@usenet.esken.de...
There is no such date as 2005-02-30, so you reach the next month.
I know, but it should increment only month (I thing so) and take maximum a
day of this month (?)
If I do this as SQL query to PostgreSQL:
SELECT TO_CHAR('YYYY-MM-DD', '2004-09-30' + interval '5 months')
then return '2005-02-28'
The documentation at
http://www.php.net/manual/en/function.strtotime.php
leads me to the GNU date syntax at
http://www.gnu.org/software/tar/manu..._7.html#SEC115.
There, at chapter 7.6 (Relative items in date strings), you'll find the
following example:
| 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.
Regards,
Matthias