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> 10/8/2024 7:53:50 PM<br>
<b>Formatted date:</b> October 08