Calculates the difference between date series in seconds.
DTDURATION(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. |
A series, the elapsed duration in seconds.
If only one date series is specified,
the durations are computed on the
W1: ymd2date(2010, 11, 12)
W2: ymd2date(2020, 10, 20)
W3: dateduration(w2, w1)
W4: dateoffset(w1, days:seconds2days(w3))
W1 contains the date:
11/12/2010
W2 contains the date:
10/20/2020
W3 computes the difference between the two date series in seconds. The duration is 313632000 seconds.
W4 calculates the end date in W2 by adding the time offset in seconds from W3, converted to days for DATEOFFSET compatibility, to the start date in W1.
W1: ymd2date(2010, 11, 12)
W2: ymd2date(2020, 10, 20)
W3: dateduration(w1, w2)
W4: dateoffset(w2, days:seconds2days(w3))
Same as the first example, except the start and end dates are swapped. The result is a negative duration of -313632000 seconds.
W4 calculates the earlier end date in W1 by subtracting the time offset in W3 from the start date in W2.
W1: gnorm(10, days2seconds(3))
W2: col(getdt(w1), 1)
W3: dateduration(w2)
W4: seconds2days(w3)
W1 contains 10 random samples with a time spacing of 3 days between samples.
W2 computes the date values for each sample in W1.
Because only one
date series input was given, W3 computes the
W4 displays the time differences contained in W3 in days. The result is 3 days, matching the time spacing of W1.
W1: gnorm(10, hours2seconds(2) + minutes2seconds(10) + 13.5)
W2: getdt(w1)
W3: dtduration(w2)
W4: w3;setvunits("Real Time")
W1 contains 10 random samples with a time spacing of 7813.5 seconds or 2 hours 10 minutes and 13.5 seconds between samples.
W2 computes the date time values for each sample in W1.
Because only one date time series was given, W3 computes the two-point difference between subsequent samples of W2. The result is 7813.5 seconds for each sample, equal to the original sample spacing of the series in W1.
W4 displays the durations in W3 in
DATEDURATION computes the duration between two date series with the result in seconds.
If only one date series is provided, the
A date duration is measured in seconds.
A date period is measured in years, months and days.
See DATEPERIOD to compute the date period in years, months and days.