formatDate
Writes a time as text: a date pattern, or a keyword such as long, iso, unix or relative.
Details #
formatDate(time, format?, zone?) takes one to three arguments and returns text.
time is a time in seconds since 1970, or text parseDate can read, so
formatDate("next friday", "long")works.format is a date pattern such as
yyyy-MM-dd HH:mm, or a keyword:short,medium,long,full(the date),time,datetime(the default: medium date and short time),iso(with the offset),isodate(yyyy-MM-dd),unix(whole seconds) andrelative(in 3 days,2 hours ago).zone is a city or abbreviation (
Tokyo,PST) or a time zone identifier. The default is this Mac's zone.
Parameters #
Takes 1 to 3 arguments.
{{ formatDate(text, b?, c?) }}
Examples #
formatDate(now(), "yyyy-MM-dd")2026-01-15formatDate(now(), "iso", "Tokyo")2026-01-16T00:30:00+09:00formatDate(triggerTime(), "relative")in 0 secondsGotchas #
An unknown zone is an error:
formatDate() doesn't know the time zone 'Narnia'.Month and day names follow this Mac's language.