Converts a date into a human readable string based on the specified format.
date(date, format)
Specifies the date value as a 64-bit number representing the number of milliseconds since January 1, 1970.
Specifies the format to be used to create the human readable text version of the string.
Returns the formatted date string.
To add an hour to a time, add 3,600,000 to the date value. To add a day to a time, add 86,400,000 to the date value.
The following are the date formats:
Symbol |
Meaning |
Presentation |
Example |
---|---|---|---|
G |
era designator |
text |
AD |
y |
year |
numeric |
1998 (yyyy) or 98 (yy) |
M |
month |
text and numeric |
July (MMMM) or 07 (MM) |
d |
day |
numeric |
10 |
h |
hour in a.m./p.m. (1-12) |
numeric |
12 |
H |
hour in day (0-23) |
numeric |
0 |
m |
minute |
numeric |
30 |
s |
second |
numeric |
55 |
S |
millisecond |
numeric |
457 |
E |
day in week |
text |
Tuesday |
D |
day in year |
numeric |
189 |
F |
day of week in month |
numeric |
2 (second Wednesday in July) |
w |
week in year |
numeric |
27 |
W |
week in month |
numeric |
2 |
a |
a.m./p.m. |
text |
p.m. |
k |
hour in day (1-24) |
numeric |
24 |
K |
hour in a.m./p.m. |
numeric |
0 |
z |
time zone |
text |
Pacific Standard Time |
> |
escape for text |
delimiter |
|
>= |
single quote |
literal |
> |
Examples:
{! 10/27/99 } Today is {VAR date(Calendar.today, "M/d/yy")}
{! 2:30 p.m. } Meeting is at {VAR date(Message.startTime, "h:mm a")}
{! Friday, November 13, 1999} Today is {VAR date(Calendar.today, "EEEE, MMMM d, yyyy")}