Decrements the values in a date/time variable by a specified amount.
Day Specifies an offset value in days.
Hour Specifies an offset value in hours.
Minute Specifies an offset value in minutes.
Month Specifies an offset value in months.
Second Specifies an offset value in seconds.
Year Specifies an offset value in years.
NOTE: Only one keyword can be specified at a time. You cannot, for example, specify both years and months in a single DT_SUBTRACT call. But if you need to subtract, for example, one day and one hour, you can simply subtract 25 hours.
The keywords specify how the dates and/or times are decremented (subtracted from). If no keyword is specified, the default decrement is one day.
Only positive whole numbers (including zero) can be used with the keywords to specify a decrement. Therefore, the smallest unit that can be subtracted from dt_var is one second.
dtvar = VAR_TO_DT(1992, 03, 17, 09, 30, 54)
dtvar1= DT_SUBTRACT(dtvar, Year=4)
PRINT, dtvar1
{ 1988 3 17 9 30 54.0000 86017.396 0}
dtarray = STR_TO_DT(['17-03-92', $ '8-04-93'], Date_Fmt=2)
DT_PRINT, dtarray
03/17/1992
04/18/1993
dtarray1 = DT_SUBTRACT(dtarray, /Day)
DT_PRINT, dtarray1
03/16/1992
04/17/1993
x = VAR_TO_DT(1992, 12, 26)
y = DT_SUBTRACT(x, /Day, /Compress)
DT_PRINT, y
12/24/1992
For more information on date/time, see the PV-WAVE User's Guide.