Returns a date/time array variable beginning with a specified date and incremented by a specified amount.
dimension
Day
Hour
Minute
Month
Second
Year
NOTE: Only one keyword can be specified at a time. You cannot, for example, specify both years and months in a single DTGEN call. But if you need to add, for example, one day and one hour, you can simply add 25 hours.
DTGEN lets you generate date and time data that match a particular dataset. For example, if you have gathered data at regular intervals, but do not have time stamps in your dataset, you can use DTGEN to generate date and time data that corresponds to your data-gathering intervals.
Only whole numbers (including zero) can be used with the keywords to specify the offset between dates and times. Therefore, the smallest unit by which generated dates can be offset is one second. If no keyword is specified, the default offset is one day.
date1 = TODAY()
date2 = DTGEN(date1, 4, /Year)
PRINT, date2
{ 1992 3 26 6 28 50.0000 87487.270 0}
{ 1993 3 26 6 28 50.0000 87852.270 0}
{ 1994 3 26 6 28 50.0000 88217.270 0}
{ 1995 3 26 6 28 50.0000 88582.270 0}
date = VAR_TO_DT(1992, 1, 1)
date1 = DTGEN(date, 6, Month=2)
PRINT, date1
{ 1992 1 1 0 0 0.00000 87402.000 0}
{ 1992 3 1 0 0 0.00000 87462.000 0}
{ 1992 5 1 0 0 0.00000 87523.000 0}
{ 1992 7 1 0 0 0.00000 87584.000 0}
{ 1992 9 1 0 0 0.00000 87646.000 0}
{ 1992 11 1 0 0 0.00000 87707.000 0}