new Date() Last updated: 20. Jun 2023

Returns current date and time.

Parameters

This function takes no parameters

Returns

Date and time object with "Now" value. Also available through the docly.getDate() function.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
<b>Raw Date:</b> #write(new Date())#<br>
<b>Formatted date:</b> #{
    var d = new Date(); // Same as getdate()
    write(docly.format(d, "MMMM dd"));
}#

Output

The #JS code above produces the output shown below:
<b>Raw Date:</b> 11/21/2024 10:51:54 AM +01:00<br>
<b>Formatted date:</b> November 21