Views:

Description

Calculate the elapsed difference in time between 2 dates for a specified interval. It is very rare that anyone would use this function as most people expect the functionality from the regular DateDiff() function.

Elapsed in this context is the difference count on the requested element, e.g. day, month, etc. See example 2 below which is looking at the difference in months; the first input parameter has a date starting in November (11) and second date has March (03). Counting an elapsed time of December, January, February, March gives us a result of 4.

Signature

DateDiffElapsed('fromdate', 'todate', 'interval')

Parameters

Name Required Type Description
fromdate Yes Date From Date
todate Yes Date To Date
interval Yes String 'y'- Years, 'm'- Months, 'd'- Days, 'h'- Hours, 'mi'- Minutes, 's'- Seconds

Example 1

DateDiffElapsed('11/08/2009', '03/20/2011', 'y') Returns 1 (US Format) 

Example 2

DateDiffElapsed('11/08/2009', '03/20/2011', 'm') Returns 4 (US Format) 

Example 3

DateDiffElapsed('11/08/2009', '03/20/2011', 'd') Returns 12 (US Format)