I have a C# application that is adding row to a SQLite database table. The timestamp is a DateTime object with the milliseconds set to a value and the Kind is set to Utc.
When I add many of these to the database, I'll have rows with the same time except the milliseconds are different. Some milliseconds have the trailing 0 cut off, but still have the 'Z' to indicate UTC timezone.
The problem I'm having is that when I get the rows and order by the timestamp, the rows with the non-zero milliseconds will appear before the rows with truncated-zero times.
I think this is because the "order by" is comparing a number to a 'Z'.
Here are 2 rows and the order they are returned:
2019-07-26 20:02:38.41Z
2019-07-26 20:02:38.4Z
I want the "38.4" time to come ahead of "38.41".
Question How do I store the DateTime object in the database with non-truncated 0 milliseconds?
or
What SQL statement do I use to order the datetime column correctly?