Comment by em500
You don't actually know how they're stored. SQLite has a rather idiosyncratic approach to datetimes: it does not provide any datetime data types (the only SQLite data types are NULL, INTEGER, REAL, TEXT and BLOB). It's left entirely to the user how to store datetimes using these types. What SQLite does provide are functions (documented on the submitted page) that translate some datetime representations (stored using the one of the mentioned basic datatypes) to other formats. So you can choose to store your datetimes in unix-epoch INTEGER and use the translation functions to output ISO8601 TEXT when needed, or the other way around: there is no correct or even preferred way in SQLite.
You have two choices.
UNIX epoch time is defined as the number of seconds since 1970/1/1 midnight. You can do those.
I think there is also Julian time, which incorporates the Gregorian skip. It is stored as a floating point number, the integer portion being the day, and the fractional part being the hour.