Format Codes
#strftime() #formatPhp() #formatSql()† Example Meaning
Year
%Y Y yyyy 2008 Four-digit year
%y y yy 08 Two-digit year
Month
%m m mm 09 Two-digit month
%#m n m 9 One or two-digit month
%B F mmmm September Full month name
%b M mmm Sep Abbreviated month name
Day
%d d dd 05 Two-digit day of month
%#d j d 5 One or two-digit day of month
%e 5 One or two-digit day of month
%A l dddd Sunday Full name of the day of the week
%a D ddd Sun Abbreviated name of the day of the week
%w w w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
%o D th The ordinal suffix string following the day of the month
Hour
%H H hh24 23 Hours in 24-hour format (two digits)
%#H G h24 3 Hours in 24-hour integer format (one or two digits)
%I h hh or hh12 11 Hours in 12-hour format (two digits)
%#I g h12 3 Hours in 12-hour integer format (one or two digits)
%p A am or pm PM AM or PM
a pm am or pm
Minute
%M i mi 09 Minutes (two digits)
%#M 9 Minutes (one or two digits)
Second
%S s ss 02 Seconds (two digits)
%#S 2 Seconds (one or two digits)
%s U 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
Millisecond
%N 008 Milliseconds (three digits)
%#N 8 Milliseconds (one to three digits)
Timezone
%O Z 360 difference in minutes between local time and GMT
%Z E EST Name of timezone as reported by browser
%G P -06:00 Hours and minutes between GMT
Shortcuts
%F 2008-03-26 %Y-%m-%d
%T 05:06:30 %H:%M:%S
%X 05:06:30 %H:%M:%S
%x 03/26/08 %m/%d/%y
%D 03/26/08 %m/%d/%y
%#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
%v 3-Sep-2008 %e-%b-%Y
%R 15:31 %H:%M
%r 3:31:00 PM %I:%M:%S %p
c 2008-03-26T15:31:00-07:00 Y-m-d\TH:i:sP (iso 8601)
r Sat, 23 Oct 2010 14:46:03 -0600 D, j M Y H:i:s O (rfc 2822 - Internet Message Format)
Literals
%n \n Newline
%t \t Tab
%% % Percent Symbol