ExampleUpdated 24 Oct 2026
Get todays date
Simple demo outputting today's date. Note: a hash page is rendered once and served from the cache, so new Date() shows the date the page was rendered - not today. Use the current date in API functions, which are not cached.
Example
Data
{
"MyDateField": "2001-01-01"
} Code Dates.hash
<b>Today:</b>
#{
let today = new Date();
write(format(today, "dd.MM.yyyy"));
}#
<b>Convert from string to date:</b>
#{
let somedate = new Date(MyDateField);
write(format(somedate, "dd.MM.yyyy"));
}#
Output
<b>Today:</b>
02.11.2026
<b>Convert from string to date:</b>
01.01.2001