Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the "formal" name of MySQL's DATETIME format?

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?

like image 757
smitelli Avatar asked Dec 06 '12 14:12

smitelli


People also ask

What format is MySQL datetime?

MySQL retrieves and displays DATETIME values in ' YYYY-MM-DD hh:mm:ss ' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59' . The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

What is the standard datetime format?

The ISO standard takes a general-to-specific approach for its date formats: The year comes first, followed by the month and then by the day of the month, with most elements represented as numerical values. For example, the ISO representation for July 15, 2022 is either 20220715 or 2022-07-15.

What is rfc3339 time format?

RFC 3339 is an RFC standard for time strings, which is to say how to represent a timestamp in textual form. In its RFC form, it says that it is for 'timestamps for Internet protocol events', but it's been adopted as a time format well beyond that; for example, some Prometheus tools use it.

What is the format of TIMESTAMP in SQL?

SQL Date Data Types TIMESTAMP - format: YYYY-MM-DD HH:MI:SS.


1 Answers

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.

like image 153
Olaf Dietsche Avatar answered Oct 14 '22 00:10

Olaf Dietsche