Home » MySQL Date and Time

MySQL Date and Time

by Online Tutorials Library

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.

EXAMPLE FORMAT
‘2018-10-18’ ‘YYYY-MM-DD’
‘20181018’ ‘YYYYMMDD’
20181018 YYYYMMDD
’18-10-18′ ‘YY-MM-DD’
181018 YYMMDD
‘2018-10-18 5:25:20’ ‘YYYY-MM-DD HH:MM:SS’
‘2018101852520’ ‘YYYYMMDDHHMMSS’
2018101852520 YYYYMMDDHHMMSS
’18-10-18 5:25:20′ ‘YY-MM-DD HH:MM:SS’
‘18101852520’ ‘YYMMDDHHMMSS’
18101852520 YYMMDDHHMMSS

Example 1

MySQL Date and Time

Example 2

MySQL Date and Time


Next TopicMySQL Procedure

You may also like