DRH wrote
The date and time functions ... are fully tested ...
I'm using SQLite version 2.8.8, precompiled binaries, on Linux. The date/time functions seem to work, but some of the modifiers don't. Specifically, 'gregorian', 'julian', 'start of week', 'localtime', and 'utc' all cause the functions to return NULL; also 'N months' and 'N years' zero the time (maybe that's intentional).
The wiki documentation is out of date.
Here are some examples cut and pasted from an interactive session:
SELECT julianday('1066-10-14','gregorian'); <null>
The 'gregorian' and 'julian' modifiers are not implemented.
Feel free to update the wiki to record this fact.
sqlite> select datetime('now', 'start of week'); <null>
The 'start of week' modifier is replaced by 'weekday N' (where N is a digit between 0 and 6. 0==Sunday, 1==Monday, etc.) This advances the date to the beginning of the next weekday identified. See comments in the source code for details.
Feel free to update the Wiki.
sqlite> select datetime('now', 'localtime'); <null> sqlite> select datetime('2004-01-05 00:00:00', 'localtime'); <null> sqlite> select datetime(2453010, 'localtime'); <null>
All these work in the latest version under CVS. But not in the 2.8.8 release tarball.
sqlite> select datetime(2453010); 2004-01-05 12:00:00
sqlite> select datetime('now', '20 minutes'); 2004-01-05 15:41:02
What were you expecting to see here? I say the two example above are working correctly.
sqlite> select datetime('now', '2 months'); 2004-03-05 00:00:00
I suppose you could argue that this should preserve the HH:MM:SS. Write a ticket for this one.
-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]