Home  >  Q&A  >  body text

What does the number 6 in the MySQL DATETIME field mean?

<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>
P粉147747637P粉147747637458 days ago612

reply all(2)I'll reply

  • P粉347804896

    P粉3478048962023-08-10 11:04:55

    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.

    reply
    0
  • P粉714844743

    P粉7148447432023-08-10 00:53:18

    This is explained in detail on the next page of the table of contents (emphasis mine):

    • So DATETIME is equivalent to DATETIME(0).
    • And DATETIME(6) is not equivalent to DATETIME or DATETIME(0).

    reply
    0
  • Cancelreply