Literals: Date and Time

In MySQL programming, Date and Time literals are in the form of strings or numbers.

Following are some more formats in which date and time can be displayed.

EXAMPLEFORMAT
'2018-10-18''YYYY-MM-DD'
'20181018''YYYYMMDD'
20181018YYYYMMDD
'18-10-18''YY-MM-DD'
181018YYMMDD
'2018-10-18 5:25:20''YYYY-MM-DD HH:MM:SS'
'2018101852520''YYYYMMDDHHMMSS'
2018101852520YYYYMMDDHHMMSS
'18-10-18 5:25:20''YY-MM-DD HH:MM:SS'
'18101852520''YYMMDDHHMMSS'
18101852520YYMMDDHHMMSS

Example 1

MySQL Date and Time

Example 2

MySQL Date and Time
Next TopicMySQL Procedure




Latest Courses