What does the number 6 in the MySQL DATETIME field mean?
P粉147747637
2023-08-09 14:34:58
<p>I can't find it in DATETIME, but usually I define it as <code>DATETIME</code> without precision specifier. </p>
<p>When running Hibernate automatic DDL update, I noticed that it changes the table to <code>DATETIME(6)</code></p>
It represents the precision of millisecond storage.
DATETIME(6) means that decimal milliseconds are stored to 6 decimal places. For example, 1970-01-01 17:51:04.789463.
The number must be in the range between 0 and 6.
This is explained in detail on the next page of the table of contents (emphasis mine):
DATETIME
is equivalent toDATETIME(0)
.DATETIME(6)
is not equivalent toDATETIME
orDATETIME(0)
.