text dateFormat(timestamp, pattern, timeZone, language)
Returns the timestamp in timeZone, formatted according to pattern in language.
Predefined patterns:
"datetime"
for the device default date & time format, the default"date"
for the device default date only format"time"
for the device default time only format"iso8601"
for "yyyy-MM-dd'T'HH:mm:ssZ"
Pattern symbols with special meaning:
Symbol | Component | Examples |
---|---|---|
G | Era | AD |
y | Year | 2014 |
M | Month | July; Jul; 07; 7 |
w | Week in year | 27 |
W | Week in month | 2 |
D | Day in year | 189 |
d | Day in month (1-31) | 10 |
E | Day of week | Tuesday; Tue; T |
F | Day of week in month (2nd Wed in July) | 2 |
H | Hour in day (0-23) | 0 |
k | Hour in day (1-24) | 24 |
K | Hour in am/pm (0-11) | 0 |
h | Hour in am/pm (1-12) | 12 |
a | Am/pm marker | PM |
m | Minute in hour | 30 |
s | Second in minute | 55 |
S | Millisecond | 978 |
Z | Time zone offset | -0800 |
z | Time zone name | Pacific Standard Time; PST; GMT-08:00 |
' | Avoid interpretation | 'day' d |
'' | Single quote | ''o'clock' |
Pattern | Result |
---|---|
yyyy.MM.dd G 'at' HH:mm:ss z | 2001.07.04 AD at 12:08:56 PDT |
EEE, MMM d, ''yy | Wed, Jul 4, '01 |
h:mm a | 12:08 PM |
hh 'o''clock' a, zzzz | 12 o'clock PM, Pacific Daylight Time |
K:mm a, z | 0:08 PM, PDT |
yyyyy.MMMMM.dd GGG hh:mm aaa | 02001.July.04 AD 12:08 PM |
EEE, d MMM yyyy HH:mm:ss Z | Wed, 4 Jul 2001 12:08:56 -0700 |
yyMMddHHmmssZ | 010704120856-0700 |
yyyy-MM-dd'T'HH:mm:ss.SSSZ | 2001-07-04T12:08:56.235-0700 |
Note! Use timeZone "UTC"
when timestamp is a “time of day”, i.e. seconds since midnight, value.