%a | Abbreviated weekday name (Sun..Sat) | DATE_FORMAT(DATETIME, %a)=Thu |
%b | Abbreviated month name (Jan..Dec) | DATE_FORMAT(DATETIME, '%b')=Jan |
%c | Month, numeric (0..12) | DATE_FORMAT(DATETIME, '%c')=1 |
%D | Day of the month with English suffix (0th, 1st, 2nd, 3rd, …) | DATE_FORMAT(DATETIME, '%D')=29th |
%d | Day of the month, numeric (00..31) | DATE_FORMAT(DATETIME, '%d')=29 |
%e | Day of the month, numeric (0..31) | DATE_FORMAT(DATETIME, '%e')=29 |
%f | Microseconds (000000..999999) | DATE_FORMAT(DATETIME, '%f')=000000 |
%H | Hour (00..23) | DATE_FORMAT(DATETIME, '%H')=15 |
%h | Hour (01..12) | DATE_FORMAT(DATETIME, '%h')=03 |
%I | Hour (01..12) | DATE_FORMAT(DATETIME, '%I')=03 |
%i | Minutes, numeric (00..59) | DATE_FORMAT(DATETIME, '%i')=01 |
%j | Day of year (001..366) | DATE_FORMAT(DATETIME, '%j')=029 |
%k | Hour (0..23) | DATE_FORMAT(DATETIME, '%k')=15 |
%l | Hour (1..12) | DATE_FORMAT(DATETIME, '%l')=3 |
%M | Month name (January..December) | DATE_FORMAT(DATETIME, '%M')=January |
%m | Month, numeric (00..12) | DATE_FORMAT(DATETIME, '%m')=01 |
%p | AM or PM | DATE_FORMAT(DATETIME, '%p')=PM |
%r | Time, 12-hour (hh:mm:ss followed by AM or PM) | DATE_FORMAT(DATETIME, '%r')=03:01:00 PM |
%S | Seconds (00..59) | DATE_FORMAT(DATETIME, '%S')=00 |
%s | Seconds (00..59) | DATE_FORMAT(DATETIME, '%s')=00 |
%T | Time, 24-hour (hh:mm:ss) | DATE_FORMAT(DATETIME, '%T')=15:01:00 |
%U | Week (00..53), where Sunday is the first day of the week; WEEK() mode 0 | DATE_FORMAT(DATETIME, '%U')=04 |
%u | Week (00..53), where Monday is the first day of the week; WEEK() mode 1 | DATE_FORMAT(DATETIME, '%u')=05 |
%V | Week (01..53), where Sunday is the first day of the week; WEEK() mode 2; used with %X | DATE_FORMAT(DATETIME, '%V')=04 |
%v | Week (01..53), where Monday is the first day of the week; WEEK() mode 3; used with %x | DATE_FORMAT(DATETIME, '%v')=05 |
%W | Weekday name (Sunday..Saturday) | DATE_FORMAT(DATETIME, '%W')=Thursday |
%w | Day of the week (0=Sunday..6=Saturday) | DATE_FORMAT(DATETIME, '%w')=4 |
%X | Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V | DATE_FORMAT(DATETIME, '%X')=2015 |
%x | Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v | DATE_FORMAT(DATETIME, '%x')=2015 |
%Y | Year, numeric, four digits | DATE_FORMAT(DATETIME, '%Y')=2015 |
%y | Year, numeric (two digits) | DATE_FORMAT(DATETIME, '%y')=15 |
%% | A literal % character | DATE_FORMAT(DATETIME, '%%')=% |
%x | x, for any “x” not listed above | DATE_FORMAT(DATETIME, '%x')=x |