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, 2350🔥, 0💬
Popular Posts:
How to download and install SQL Server 2005 Sample Scripts in SQL Server? If you want to learn from ...
How to obtain the number of rows found by the last SELECT statement using the FOUND_ROWS() function?...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...