Question

Does anybody know the formal name of the YYYY-MM-DD HH:MM:SS date format used by a MySQL DATETIME? Is there one? It looks close to ISO 8601, but it's different enough to break in most applications if you try to use the two interchangeably.

Sometimes I find myself needing to refer to this particular format in conversation, but referring to it as "the DATETIME format" always draws blanks from those who haven't done much work with databases. I'm accustomed to date formats having official names and extremely formal definitions. (RFC 2822, anyone?) So, does one exist?

Was it helpful?

Solution

MySQL's Date and Time Literals are described in the reference manual. AFAICS, there's neither ISO nor any other name mentioned.

Wikipedia, ISO 8601 shows the ISO combined date and time format, which is "2012-12-04T20:03" ("YYYY-MM-DDTHH:MM") and differs from the mentioned MySQL datetime format.

So, although it looks roughly like an ISO datetime, I would just call it MySQL or SQL format.

OTHER TIPS

2021

Olaf Dietsche's answer is right but old (2012) & slightly inaccurate as of 2021. According to Wikipedia ISO 8601:

As of ISO 8601-1:2019, the basic format is T[hh][mm][ss] and the extended format is T[hh]:[mm]:[ss]. Earlier versions omitted the T (representing time) in both formats.

Also from same link:

ISO 8601-1:2019 allows the T to be omitted in the extended format, as in "13:47:30", but only allows the T to be omitted in the basic format when there is no risk of ambiguity with date expressions.


MySQL in their documentation mention "ISO" (with no number), in one link they did mention that ISO format refers to ISO 9075, not ISO 8601..

ISO 9075 is basically MySQL standards.

btw, ISO 8601 & RFC 3339 are pretty much the same thing (from developers' perspective). In case you are interested, read.


Bottom line:

MySQL datetime format matches same format of ISO-8601 / RFC-3339 , although MySQL has its own standard ISO 9075. So, for the MySQL datetime format, we can refer to it as any of the below:

  • ISO 8601 aka RFC 3339
  • MySQL format aka ISO 9075.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top