Calculates the difference between two date series in years, months and days.
DATEPERIOD(date1, date2)
(y, m, d) = DATEPERIOD(date1, date2)
date1 |
- |
A series of Julian integer dates, the end dates. |
date2 |
- |
Optional. A series of Julian integer dates, the start dates. Defaults to an empty series. |
The elapsed period as an N x 3 series of years, months, days.
(y, m, d) = DATEPERIOD(date1, date) returns the values in separate variables.
If only one date series is specified,
the periods are computed on the
W1: ymd2date(2010, 11, 12)
W2: ymd2date(2020, 10, 20)
W3: dateperiod(w2, w1)
W4: dateoffset(w1, w3)
W1 contains the date:
11/12/2010
W2 contains the date:
10/20/2020
W4 calculates the end date in W2 by adding the time offset in W3 to the start date in W1.
W1: ymd2date(2010, 11, 12)
W2: ymd2date(2020, 10, 20)
W3: dateperiod(w1, w2)
W4: dateoffset(w2, w3)
Same as the first example, except the start and end dates are swapped. The result is a negative period, -9 years, -11 months and -8 days.
W4 calculates the end date in W1 by subtracting the time offset in W3 from the start date in W2.
DATEPERIOD computes the difference between two date series with the result in periods of years, months and days.
If only one date series is provided, the
A date period is measured in years, months and days.
A date duration is measured in seconds.
See DATEDURATION to compute the time difference in seconds.