Get todays date Last updated: 28. Feb 2023

Simple demo outputting todays date. Note that getting todays date onle makes sense to use in API functions, as all other server pages will be 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>
21.11.2024

<b>Convert from string to date:</b>
01.01.2001