new Date() Last updated: 01. May 2026

Returns current date and time.

See also: Compare date field with todays date Get todays date SetCulture date og number format

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/2026 2:48:52 PM +02:00<br>
<b>Formatted date:</b> May 08