1.0.165 timestamp formatting in new template

@merlinuwe

I have had a play and these appear to be some values you can use to format the date/time however you want it.

Example:

Sunday 18 August 2019 7:35 and 45 seconds pm

Value Output Note
d 0 Day of the week (0-6)
dd Su Day of the week (name abbreviated 2 chars)
ddd Sun Day of the week (name abbreviated 3 chars)
dddd Sunday Day of the week (name full)
D 18 Date (numeric)
Do 18th Date (numeric with suffix)
DD 18 Date (numeric always 2 digits)
DDD 230 Day of the year
w 34 Week of the year
M 8 Month (numeric)
MM 08 Month (numeric always 2 digits)
MMM Aug Month (name abbreviated)
MMMM August Month (name full)
Y 2019 Year (full)
YY 19 Year (abbreviated)
YYYY 2019 Year (full)
h 7 Hour (12 hour clock)
hh 07 Hour (12 hour clock always 2 digits)
H 19 Hour (24 hour clock)
HH 19 Hour (24 hour clock always 2 digits)
m 35 Minutes
mm 35 Minutes (always 2 digits)
s 45 Seconds
ss 45 Seconds (always 2 digits)
a pm am / pm indicator

So

{{#custom_datetime}}dddd, D. MMMM Y HH:mm U\hr{{/custom_datetime}}
Sunday, 18. August 2019 19:35 Uhr

{{#custom_datetime}}dddd, Do MMMM Y h:mm:ssa{{/custom_datetime}}
Sunday, 18th August 2019 7:35:45pm

It looks like moment.js has a .fromNow(); function but I am not a programmer and so I assume from calebjohn’s comment above it would require a new template function to be created to use it.

10 Likes