Reference Guide > D Routines > DT_DURATION Function
  

DT_DURATION Function
Standard Library function that determines the elapsed time between the values in two date/time variables.
Usage
result = DT_DURATION(dt_var_1, dt_var_2)
Input Parameters
dt_var_1 — The date/time variable to be subtracted from. Can be a scalar or array variable.
dt_var_2 — The date/time variable to subtract. Can be a scalar or array variable.
Returned Value
result — A double-precision array containing the difference between dt_var_1 and dt_var_2 in days and fractions of days.
Keywords
CompressIf present and nonzero, excludes predefined weekends and holidays from the calculation of duration. The default is no compression (0).
Discussion
If the input arrays are not of the same dimension, the output will be the size of the smallest input array.
Example
; Create two date/time variables containing February 1, 2004 
; and March 1, 2004.
DT1 = str_to_dt('01-02-2004', Date_Fmt=2)
DT2 = str_to_dt('01-03-2004', Date_Fmt=2)
diff = DT_DURATION(DT2, DT1)
PRINT, diff
; PV-WAVE prints: 29.000000
; The difference between these dates is 29 days.
See Also
DT_ADD,   DT_SUBTRACT
For more information on date/time, see the PV‑WAVE User’s Guide.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.