| Format |
Name |
Example(s) |
| %A |
Full weekday name |
Monday |
| %a |
Abbreviated weekday name |
Mon. |
| %B |
Full month name |
January |
| %b |
Abbreviated month name |
Jan. |
| %C |
First two digits of year |
20 (for 2009) |
| %c |
Time and date |
Fri May 29 18:42:15 2009 |
| %D |
Short for %m/%d/%y |
05/29/09 |
| %d |
Day of the month (leading zero if applicable) |
09 or 27 |
| %e |
Day of the month (no leading zero) |
9 or 27 |
| %F |
Short for %Y-%m-%d |
2009-05-29 |
| %G |
Full year* containing “the greater part of the week” |
2009 |
| %g |
Last two digits of %g |
09 |
| %H |
Hour, 24-hour format, leading zero if applicable |
17 or 09 |
| %h |
Same as %b: abbrev. month name |
Oct. |
| %I |
Hour, 12-hour format |
11 or 07 |
| %j |
Day of the year |
365 |
| %k |
Hour, 24-hour format, without leading zero |
17 or 9 |
| %l |
Hour, 12-hour format, without leading zero |
11 or 7 |
| %M |
Minute, with leading zero if applicable |
57 or 05 |
| %m |
Month, with leading zero if applicable |
08 |
| %n |
Line break / newline (for formatting) |
|
| %p |
AM or PM |
AM |
| %R |
Same as %H:%M |
18:53 |
| %r |
Same as %I:%M:%S %p |
06:53:43 PM |
| %S |
Second, with leading zero |
07 or 59 |
| %s |
Number of seconds since epoch |
1243637689 |
| %T |
Same as %H:%M:%S |
18:55:09 |
| %t |
Tab (for formatting) |
|
| %U |
Week (number) of the year* |
51 |
| %v |
Same as %e-%b-%Y |
29-May-2009 |
| %W |
Week (number) of the year* |
21 |
| %w |
Day of the week. Caveat: 0-6 (Sun-Sat) |
6 |
| %X |
Time in local format |
19:00:08 |
| %x |
Date in local format |
05/29/2009 |
| %Y |
Full year |
2009 |
| %y |
Short year (last two digits) |
99 |
| %Z |
Time zone name |
EDT |
| %z |
Time zone difference from UTC (-0400: behind 4 hours, 00 minutes) |
-0400 |
| %+ |
Local date and time format |
Fri May 29 19:06:31 EDT 2009 |
| %% |
A literal percent sign |
% |