Skip to content

DATEDIFF

Usage

Use this function to return the difference betweeen two Dates or two Timespan. First parameter is Start Date, second is End Date and third is the format that could be: days, weeks, months, years, hh hours, minutes, ss seconds, years or between two Timespans in a format that could be: days, hhours, minutes, seconds

Category Function Type Where to use Argument statement
FUNCTION SERVER ROW DATE .VALUE

Syntax

1
=DATEDIFF(Value_1; Value_2; Key)

Arguments

Value_1
Subtract: any date or timespan cell value (#Storage_Name.Field_Name.VALUE or .OLDVALUE), System Variables or function-returned date or timespan value

Value_2
Minuend: any date or timespan cell value (#Storage_Name.Field_Name.VALUE or .OLDVALUE), System Variables or function-returned date or timespan value

Key
For Date: d for days, w for weeks / m for months / y for years, hh for hours, mi for minutes and ss for seconds (not key sensitive)
For Timespan: d for days, , hh for hours, mi for minutes and ss for seconds (not key sensitive)

Return Value

Numeric

Examples

Example 1

Formula
=DATEDIFF("01/01/2020"; "31/12/2020"; d)

Description
Subtract from the date 31/12/2020 the date "01/01/2020" and return number of days

Result
365

Example 2

Formula
=DATEDIFF(#StorageExample.Date_1.VALUE; #StorageExample.Date_2.VALUE; months)

Description
Subtract from the cell values of the field date type Date_2 in the StorageExample the cell values of the field date type Date_1 in the StorageExample and return number of months

Result
Date_2 - Date_1

Example 3

Formula
=DATEDIFF(#StorageExample.Timespan_1.VALUE; #StorageExample.Timespan_2.VALUE; d)

Description
Subtract from the cell values of the field timespan type Timespan_2 in the StorageExample the cell values of the field timespan type Timespan_1 in the StorageExample and return number of months

Result
Timespan_2 - Timespan_1