What are the different time format characters used by MySQL DATE_FORMAT() function?

MySQLMySQLi Database

Different time format characters used by MySQL DATE_FORMAT() function are as follows −

Time Format Character
Meaning
 %H
It is used to abbreviate Hour on a 24-hour clock in two digits format like 00, 01, 02 up to 23.
 %h
It is used to abbreviate Hour on 12-hour clock in two digits format like 01, 02 up to 12.
 %i
It is used to abbreviate minutes in two digits format like 01, 02 up to 59.
 %l
It is used to abbreviate Hour on 12-hour clock in two digits format without zero-like 01, 02 up to 12.
 %p
It is used for A.M or P.M.
%r
It is used to display time on 12-hour clock as HH:MM:SS.
%s
It is used to abbreviate seconds in two digits format like 01, 02 up to 59.
 %T
It is used to display time on the 24-hour clock as HH:MM:SS.
%f
It is used to display Microseconds in the range of
000000..999999.
raja
Published on 19-Feb-2018 14:18:04
Advertisements