SQLite WHERE fails for DATE datatype comparison

Jump to: navigation, search

Using the WHERE SQLite clause on a column that is of DATE data type requires the argument to be in Julian Date (JD) format which is a numerical value measuring the number of days in and fractions thereof since the JD epoch. JD epoch is Jan 1, 4713 BC Greenwich noon. Since ECMAScript Date object has no Julian date methods, your code will be simpler if just make your date column datatype CHAR(10). Be sure to zeropad both months and days to two digits. Beware that the Date object's getMonth() method returns a value from 0-11, not 1-12.

See also

Use your Android as a Liftmaster garage door opener remote

Personal tools