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> 5/8/2024 2:32:55 AM<br>
<b>Formatted date:</b> May 08