Collections:
Writing Date and Time Literals in MySQL
How To Write Date and Time Literals in MySQL?
✍: FYIcenter.com
MySQL offers a number of formats for you to use to enter date and time literals:
The tutorial exercise below gives you some good examples:
SELECT DATE('1997-01-31') FROM DUAL;
1997-01-31
SELECT DATE('1997-01-31 09:26:50') FROM DUAL;
1997-01-31
SELECT TIME('1997-01-31 09:26:50') FROM DUAL;
09:26:50
SELECT DATE('1997/01/31 09^26^50') FROM DUAL;
1997-01-31
SELECT TIME('1997/01/31 09^26^50') FROM DUAL;
09:26:50
SELECT DATE('19970131') FROM DUAL;
1997-01-31
SELECT TIME('092650') FROM DUAL;
09:26:50
SELECT DATE(19970131) FROM DUAL; -- Crazy format
1997-01-31
SELECT TIME(092650) FROM DUAL; -- Crazy format
09:26:50
⇒ Entering Microseconds in SQL Statements in MySQL
⇐ What are Date and Time Data Types in MySQL
2017-12-26, 2880🔥, 0💬
Popular Posts:
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How To Round a Numeric Value To a Specific Precision in SQL Server Transact-SQL? Sometimes you need ...
Where to find tutorials to answer some frequently asked questions on Microsoft SQL Server Transact-S...
How To Verify Your PHP Installation in MySQL? PHP provides two execution interfaces: Command Line In...
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...