[odb-users] dates and times in sqlite3

Boris Kolpackov boris at codesynthesis.com
Fri Jul 11 04:04:06 EDT 2014


Hi Dave,

Dave Johansen <davejohansen at gmail.com> writes:

> I'm probably a little late to this conversation and don't know if a change
> like this is even possible in the ODB codebase, but all the uses of sqlite
> that I've worked with store date/time in Julian Day/Date format (
> http://en.wikipedia.org/wiki/Julian_day ) so that it's smaller and easier
> to work with (- and + just work and have intuitive results). sqlite3 also
> knows how to convert to/from Julian Day/Date and string formats (
> http://www.sqlite.org/lang_datefunc.html ).

Thanks for the info. Currently, the ODB profiles (Boost, Qt) support
storing date/time types as either text (the ISO format, default) or
integer (UNIX time, needs to be requested explicitly). See Section
23.5.2 for the Boost profile and 24.4.2 for the Qt profile.

It is also possible to add support for Julian at the application level
by simply implementing the traits (and I assume mapping to the FLOAT
database type), just like the profiles do. Whether it is worth adding
this code into the profiles themselves, I am not sure. You are the
first person who mentioned any desire for this.

Boris



More information about the odb-users mailing list