GET_FORMAT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a format string that can be used for rendering dates and time values.
USAGE
GET_FORMAT({DATE|TIME|DATETIME|TIMESTAMP}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'})
Argument Name | Description |
|---|---|
| The date value type |
| The format type or locale |
DETAILS
GET_FORMAT() returns a format string for the given date component and format type.
The return value can be passed to functions such as DATE_FORMAT(), STR_TO_DATE(), and FROM_UNIXTIME().
A NULL is returned if the second argument is NULL.
EXAMPLES
SELECT GET_FORMAT(DATE, 'EUR');
+-------------------------+
| GET_FORMAT(DATE, 'EUR') |
+-------------------------+
| %d.%m.%Y |
+-------------------------+
SELECT GET_FORMAT(DATETIME, 'USA');
+-----------------------------+
| GET_FORMAT(DATETIME, 'USA') |
+-----------------------------+
| %Y-%m-%d %H.%i.%s |
+-----------------------------+
