Skip to content

Instantly share code, notes, and snippets.

@tfentonz
Created January 11, 2016 02:01
Show Gist options
  • Save tfentonz/d14cf1ba647f39b58776 to your computer and use it in GitHub Desktop.
Save tfentonz/d14cf1ba647f39b58776 to your computer and use it in GitHub Desktop.
MySQL GET_FORMAT
SELECT
NOW() AS 'now',
GET_FORMAT(DATE, 'ISO') AS 'format',
DATE_FORMAT(NOW(), GET_FORMAT(DATE, 'ISO')) AS 'iso_8601';
+---------------------+----------+------------+
| now | format | iso_8601 |
+---------------------+----------+------------+
| 2016-01-11 12:34:56 | %Y-%m-%d | 2016-01-11 |
+---------------------+----------+------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment