Date and Time Components | Description |
d | Displays the day as a number without a leading zero (1-31). |
dd | Displays the day as a number with a leading zero (01-31). |
ddd | Displays the day as an abbreviation (Sun-Sat). |
dddd | Displays the day as a full name (Sunday-Saturday). |
D | Displays the day in the year as a number(1-365). |
M | Displays the month as a number without a leading zero (1-12) |
MM | Displays the month as a number with a leading zero (01-12). |
MMM | Displays the month as an abbreviation (Jan-Dec) |
MMMM | Displays the month as a full name (January-December). |
yy | Displays the year as a two-digit number (00-99). |
yyyy | Displays the year as a four-digit number (0000-9999). |
h | Displays the hour without a leading zero (0-12). |
hh | Displays the hour with a leading zero (00-12). |
H | Displays the hour without a leading zero (0-23). |
HH | Displays the hour with a leading zero (00-23). |
k | Displays the hour without a leading zero (0-24). |
kk | Displays the hour with a leading zero (00-24). |
K | Displays the hour without a leading zero (0-11). |
KK | Displays the hour with a leading zero (00-11). |
m | Displays the minute without a leading zero (0-59). |
mm | Displays the minute with a leading zero (00-59). |
s | Displays the second without a leading zero (0-59). |
ss | Displays the second with a leading zero (00-59). |
S | Displays millisecond without a leading zero (0-999) |
SS | Displays millisecond with one leading zero where required (00-999) |
SSS | Displays millisecond with up to two leading zero where required (000-999) |
a | Displays am/pm |
z | Displays timezone name (PDT, IST) |
Z | Displays timezone as military hours from GMT (+0530) |
X | Displays timezone as only hours from GMT (+05) |
XX | Displays timezone as military hours from GMT (+0530) |
XXX | Displays timezone in format +/- hh:mm from GMT (+05:30) |
u | Displays the day as number of weeks (1 = Monday, ..., 7 = Sunday) |
E | Displays the day as an abbreviation (Sun-Sat). |
EEEE | Displays the day as a full name (Sunday-Saturday). |
F | Displays the week number in a month (0-4) |
w | Displays the week number in a year (1-52) |
W | Displays the week number in a month (1-4) |
G | Displays the era (BC/AD) |
Single quotes | Anything written inside single quotes is not rendered |