Usage

date_format(date, pattern)

Description
Formats the given date object according to the given pattern, using the current locale (language/country settings). This method uses the Java SimpleDateFormat class which provides the following pattern chars:

LetterDate or Time Component
GEra designator
yYear
YWeek year
MMonth in year
wWeek in year
WWeek in month
DDay in year
dDay in month
FDay of week in month
EDay name in week
uDay number of week (1 = Monday, ..., 7 = Sunday)
aAm/pm marker
HHour in day (0-23)
kHour in day (1-24)
KHour in am/pm (0-11)
hHour in am/pm (1-12)
mMinute in hour
sSecond in minute
SMillisecond
zTime zone
ZTime zone
XTime zone

Each character can be repeated multiple times to control the output format.

PatternDescription
dprints one or two numbers (e.g. "1", "5" or "20")
ddprints two numbers (e.g. "01", "05" or "20")
EEE prints the shortened name of the weekday (e.g. "Mon")
EEEEprints the long name of the weekday (e.g. "Monday")

Example

${date_format(page.createdDate, 'yyyy-MM-dd')}

results in

2015-12-12

Graph-Browser

Related Articles
About this article
Last change 2017-09-20
Topics FrontendFunctionsStructr 2.0