What does the number 6 in the MySQL DATETIME field mean?
P粉147747637
P粉147747637 2023-08-09 14:34:58
0
2
496

I can't find it in DATETIME, but usually I define it as DATETIME without precision specifier.

When running Hibernate automatic DDL update, I noticed that it changes the table to DATETIME(6)

P粉147747637
P粉147747637

reply all (2)
P粉347804896

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.

    P粉714844743

    This is explained in detail on the next pageof thetable of contents (emphasis mine):

    • SoDATETIMEis equivalent toDATETIME(0).
    • AndDATETIME(6)is not equivalent toDATETIMEorDATETIME(0).
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!