Calculates the difference between date and time series in seconds.
DTDIFF(date1, time1, date2, time2)
date1 |
- |
A series of Julian integer dates, the end date. |
time1 |
- |
A series of time of day values, the end time. |
date2 |
- |
Optional. A series of Julian integer dates, the start date. Defaults to an empty series. |
time2 |
- |
Optional. A series of time of day values, the start time. Defaults to an empty series. |
DTDIFF(datetime1, datetime2)
datetime1 |
- |
An array, the end datetimes where the date and time values are in adjacent columns. |
datetime2 |
- |
Optional. An array, the start datetimes where the date and time values are in adjacent columns. Defaults to an empty array. |
A series, the elapsed duration in seconds.
If only one date and time series or one
composite date time series is specified, the durations are computed on
the
W1: ymdhms2dt(2027, 1, 2, 12, 0, 0)
W2: ymdhms2dt(2027, 3, 1, 12, 0, 0)
W3: dtdiff(w2, w1)
W4: dtoffset(w1, seconds:w3)
W1 contains the datetime:
1/02/2027 12:00:00
W2 contains the datetime:
3/01/2027 12:00:00
W3 computes difference between the two datetimes in seconds. The duration is 5011200 seconds.
W4 recovers the end datetime in W2 by adding the offset in W3 to the start datetime in W1.
W1: ymdhms2dt(2028, 1, 2, 12, 0, 0)
W2: ymdhms2dt(2028, 3, 1, 12, 0, 0)
W3: dtdiff(w2, w1)
W4: dtoffset(w1, seconds:w3)
Same as the first example, except the end and start year is 2028, a leap year. The duration is 5097600 seconds. The duration has increased by 86400 seconds from 5011200 seconds to 5097600 because of the leap year.
W1: ymdhms2dt(2027, 1, 2, 12, 0, 0)
W2: ymdhms2dt(2027, 3, 1, 12, 0, 0)
W3: dtdiff(w1, w2)
W4: dtoffset(w2, seconds:w3)
Same as the first example above, except the start and end date times are swapped. The result is a negative duration of -5011200 seconds.
W4 recovers the earlier end date in W1 time by adding the negative offset in W3 to the later start date time in W2.
W1: gnorm(10, hours2seconds(2) + minutes2seconds(10) + 13.5)
W2: getdt(w1)
W3: dtdiff(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 datetime values for each sample in W1.
Because only one date time series was given, W3 computes the
W4 displays the durations in W3 in
DTDIFF computes the difference between two datetime series with the result in seconds.
A datetime series consists of 2 columns of values where the first column contains integer Julian dates starting at midnight and the second column contains time in seconds starting from midnight.
If only one date and time series or one composite datetime series is provided, the two-point difference between subsequent date and time series values is computed.
A date time duration is measured in seconds.
A date time period is measured in years, months, days, hours, minutes and seconds.
See DTPERIOD to compute the time difference in years, months, days, hours, minutes and seconds.