AddMinutes(datetime, minutes) Last updated: 21. Dec 2022

Adding a number of minutes (positive or negative value) to a specified date and time object.

Parameters

Name Type Description
datetime Date and time object Date and time object on which to add minutes to.
minutes number (int or float) How many minutes to add to specified datetime.

Returns

A modified date and time object, does not modify input date.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    var before = new Date(); // Create new date and time object
    var after = docly.addMinutes(before, 3.5); // Add minutes
}#
<b>Before:</b> #format(before, "HH:mm:ss")#
<b>After:</b> #format(after, "HH:mm:ss")#

Output

The #JS code above produces the output shown below:
<b>Before:</b> 17:45:01
<b>After:</b> 17:48:31