Mysql, DATETIME, and milliseconds
Thursday, May 29. 2008
Mysql does not store milliseconds in its DATETIME, TIME, or TIMESTAMP types. Dates containing millisecond precision will be truncated, removing the milliseconds.
From the Mysql docs:
However, microseconds cannot be stored into a column of any temporal data type. Any microseconds part is discarded.
This is a major pain when you want to order the results of records inserted very quickly in succession. You basically have no option but to create an extra Long field in the table whose only purpose is for sorting, and dump the milliseconds in there.