Collections:
GET_FORMAT() - Standard Datetime Formats
How to get the format specifier string for a given datetime standards using the GET_FORMAT() function?
✍: FYIcenter.com
GET_FORMAT(part, std) is a MySQL built-in function that
returns the format specifier string of a datetime part for a given standard.
For example:
SELECT GET_FORMAT(DATETIME,'ISO'), GET_FORMAT(DATETIME,'USA'); -- +----------------------------+----------------------------+ -- | GET_FORMAT(DATETIME,'ISO') | GET_FORMAT(DATETIME,'USA') | -- +----------------------------+----------------------------+ -- | %Y-%m-%d %H:%i:%s | %Y-%m-%d %H.%i.%s | -- +----------------------------+----------------------------+ SELECT DATE_FORMAT(NOW(), GET_FORMAT(DATE, 'EUR')); -- +---------------------------------------------+ -- | DATE_FORMAT(NOW(), GET_FORMAT(DATE, 'EUR')) | -- +---------------------------------------------+ -- | 14.11.2023 | -- +---------------------------------------------+ SELECT DATE_FORMAT(NOW(), GET_FORMAT(DATETIME, 'EUR')); -- +-------------------------------------------------+ -- | DATE_FORMAT(NOW(), GET_FORMAT(DATETIME, 'EUR')) | -- +-------------------------------------------------+ -- | 2023-11-14 22.34.18 | -- +-------------------------------------------------+
Reference information of the GET_FORMAT() function:
GET_FORMAT(part, std): format Returns a format specifier string of a datetime part for a given standard std. part is a keyword of DATE, TIME or DATETIME. std is a standard name of 'EUR', 'USA', 'JIS', 'ISO' or 'INTERNAL'. Arguments, return value and availability: part: Required. The datetime part keyword. std: Required. The format standard name. format: Return value. The format specifier string. Available since MySQL 5.7.
⇐ FROM_UNIXTIME() - Unix Time to Datetime
2023-11-17, 957🔥, 0💬
Popular Posts:
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard...
How To Install PHP on Windows in MySQL? The best way to download and install PHP on Windows systems ...
How To Convert Character Strings into Numeric Values in SQL Server Transact-SQL? Sometimes you need ...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...