I'm looking for the best way to store a `java.time.OffsetDateTime` in a SQLite database (on Android, if that helps).

The question arises since SQLite does not have a native data type for date+time.

The criteria are that I should be able to produce sensible results from:

1. ordering on the "date+time" column.
2. Not lose small time differences (milliseconds).
3. Be able to use the equivalent of `BETWEEN`, or range, in `WHERE`
4. Not lose time zone information (devices may be used globally and roam)
5. Hopefully retain some efficiency.

At the moment I'm storing the timestamp as an ISO formatted string. Not sure that is ideal either for efficiency or for comparisons.

Perhaps a conversion to UTC and then a long (Java) is an option, but I cannot find a function in OffsetDateTime that return time since epoch (as, for example, `Instant.ofEpochMilli`).

I should probably mention that the data is stored and used on an Android device. The application code uses the timestamp and performs simple arithmetic like "how many days passed since some event". So the data is being converted between the storage type and OffsetDateTime.