Date and Time Syntax
The syntax for date and time formats is given below. You can display many formats, such as days, months, and years, in full or in truncated form, depending on the number of times that you enter a particular code character—details are given below.
Rows that have a shaded background indicate legacy date and time syntax. Product releases
Code | Description | Appearance | Example |
---|---|---|---|
‘ |
Insert a single quote at start and end of any string to indicate plain text. |
||
“ |
Single quote, entered twice |
‘ |
|
a |
AM/PM indicator |
text |
AM |
d |
Day in month |
number |
9 |
dd |
Day in month |
number |
09 |
D |
Day in year |
number |
5 156 |
DDD |
Day in year |
number |
005 156 |
EEE |
Day in week |
text |
Wed |
EEEE |
Day in week (full text) |
text |
Wednesday |
F |
Day of week in month |
number |
2 |
FF |
Day of week in month |
number |
02 |
G |
Era |
text |
AD |
h |
Hour in 12-hour clock (1 to 12) |
number |
8 12 |
hh |
Hour in 12-hour clock (1 to 12) (two digits always displayed) |
number |
08 12 |
H |
Hour in 24-hour clock (0 to 23) |
number |
7 18 |
HH |
Hour in 24-hour clock (0 to 23) |
number |
07 18 |
k |
Hour in day (24-hour clock, 1 to 24) |
number |
5 23 |
kk |
Hour in day (24-hour clock, 1 to 24) |
number |
05 23 |
K |
Hour in day (12-hour clock, 0 to 11) |
number |
3 10 |
KK |
Hour in day (12-hour clock, 0 to 11) |
number |
03 10 |
m |
Minute in hour |
number |
4 30 |
mm |
Minute in hour |
number |
04 30 |
M |
Month in year |
number |
6 |
MM |
Month in year |
number |
06 |
MMM |
Month in year |
text |
Aug |
MMMM |
Month in year |
text |
August |
s |
Second in minute |
number |
5 24 |
ss |
Second in minute |
number |
05 24 |
S |
Deciseconds |
number |
0 3 |
SS |
Centiseconds |
number |
01 32 |
SSS |
Milliseconds |
number |
016 327 |
w |
Week in year |
number |
5 32 |
ww |
Week in year |
number |
05 32 |
W |
Week in month |
number |
3 |
yy |
Year |
number |
03 |
yyyy |
Year |
number |
2003 |
z |
Time zone |
text |
GMT+01:00 |
Example:
The code d.M.yy displays a date in the form:
14.2.03
The code dd.MM.yy displays a date in the form:
14.02.03
(where entries are zero-padded if the figures are shorter than the specified amount of characters.)
The code EEE, MMM d, “yy displays a date in the form:
Fri, Feb 14, ‘03
The code EEEE, MMMM d, yyyy displays a date in the form:
Friday, February 14, 2003
The code ‘Today’’s date is: ‘EEEE, d MMMM displays:
Today’s date is: Friday, 14 February