Hi all,

I'm working on a project where I need to verify that a given date actually existed (like February 29 in a particular year). I am using SqLite to store a lot of data already and I didn't feel like hunting for a datetime library online. I figured that there should be a way to use SqLite's date functions to check this, and came up with the following query:

select 1 where date(julianday('2004-02-29'))=date('2004-02-29');

The above query returns 1 as expected. The following one returns nothing, as I would also expect:

select 1 where date(julianday('2005-02-29'))=date('2005-02-29');

Now, my question is simply this. Is the query sound? All the tests I have run thus far have given correct results (invalid days of months, leap years etc) but are there any pitfalls that I should be aware of? Is it safe to rely on the conversion between the floating point julianday and the date string being accurate if the date is in fact valid?

Kind regards,

Philip Bennefall
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to