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, 1489🔥, 0💬
Popular Posts:
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
Where to find answers to frequently asked questions on Conditional Statements and Loops in SQL Serve...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
What Is SQL*Plus in Oracle? SQL*Plus is an interactive and batch query tool that is installed with e...
What Is an Oracle Tablespace in Oracle? An Oracle tablespace is a big unit of logical storage in an ...