Collections:
Converting Dates to Character Strings in MySQL
How To Convert Dates to Character Strings in MySQL?
✍: FYIcenter.com
You can convert dates to character strings using the DATE_FORMAT(date, format) function. MySQL supports the following basic formatting codes:
The tutorial exercise below shows you some good examples:
SELECT DATE_FORMAT('1997-01-31', '%W, %M %e, %Y') FROM DUAL; Friday, January 31, 1997 SELECT DATE_FORMAT('1997-01-31 09:26:50.000123', '%W, %M %e, %Y, at %h:%i:%s %p') FROM DUAL; Friday, January 31, 1997, at 09:26:50 AM | SELECT DATE_FORMAT('1997-01-31 09:26:50.000123', '%d-%b-%Y %H:%i:%s.%f') FROM DUAL; 31-Jan-1997 09:26:50.000123
⇒ Converting Character Strings to Dates in MySQL
⇐ Entering Microseconds in SQL Statements in MySQL
2017-12-26, 1399🔥, 0💬
Popular Posts:
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...
What Is an Oracle Instance in Oracle? Every running Oracle database is associated with an Oracle ins...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...