dateAdd (Date add up)

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/warning.svg This feature is deprecated and could be removed in the course of the next updates. The new calculation function dateCalc (Calculate date).


The $dateAdd function is used to add date or time units to a date value.

Syntax

$dateAdd(part,units[,dateValue])

Parameter

Name

Description

part

Specifies which unit of the date value should be added up.

Valid values:

  • h hour

  • d day

  • m minute

  • s second

  • l millisecond

units

Specifies the number of units to add.

dateValue
(optional)

A valid date or time value, which serves as the source of the calculation.

If this parameter is not specified, the execution time is assumed ( $now( ) ).

Return value

Returns the result of the calculation as a new value, compatible with the input value (dateValue parameter). For example, if dateValue is a date range (DateRange), a date range object is returned.

Example

Executed on 03.12.2019 at 08:50.

Syntax

Result

Remarks

$dateAdd(h,11,$today())

03.12.2019 11:00

Creates a current date without time and adds 11 hours.

$dateAdd(m,30,$dateAdd(h,11,$today()))

03.12.2019 11:30

Creates a current date without time and adds 11 hours and 30 minutes to the result.

$dateAdd(h,17)

04.12.2019 01:50

Overflow: Adds 17 hours to the time of execution. This results in the following day at 01:50.