Just been messing about with the date functions, and there
appears to be an inconsistency when adding a month
modifier. I'm running Fedora 10.
[root ~]# sqlite3
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> SELECT date('2001-03-31');
2001-03-31
sqlite> SELECT date('2001-03-31', '+1 month');
2001-05-01
sqlite> SELECT date('2001-03-31', '+31 day');
2001-05-01
sqlite> SELECT date('2001-03-31', '-31 day');
2001-02-28
sqlite> SELECT date('2001-03-31', '-1 month');
2001-03-03
sqlite> SELECT date('2001-03-31', '-28 day');
2001-03-03
sqlite>
From: http://www.sqlite.org/lang_datefunc.html
"Thus, for example, the data 2001-03-31 modified by '+1
month' initially yields 2001-04-31, but April only has 30
days so the date is normalized to 2001-05-01."
When I add '+1 month' to the example data, the example date
has 31 days added to it. Which is correct.
When I subtract '-1 month' the date only gets 28 days
subtracted from it.
Surely adding or subtracting a month modifier to a date
should be the same number of days in each direction?
Kind Regards,
Keith Roberts
-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users