Home > Language Reference > Date/Time Functions > DateToDate$

DateToDate$

The DatetoDate$ function returns a new date value based on adding an interval to the specified date.

Syntax

var$=DatetoDate$(<interval>,<number>,<date>)

Parameters

<interval>, string, kind of interval to use. The possible values are:

 <interval> parameter  Description
 d  Day
 w      Weekday
 ww  Week
 y  Day of year
 yyyy  Year
 q      Quarter
 m  Month
 h  Hour
 n  Minute
 s  Second

<number>, integer, number of intervals to add. It can be a negative value to get an earlier date.

<date>, string, start date. The format is the short date format as specified in Language and Region Settings (for example 12/23/2013).

Return value

var$, string, new date. 

Remarks

To add days to the specified date, "y", "d" or "w" give the same result.

See also

Date$
DateBetween
Day$
Hour$
Hundreds
Min$
Month$
Sec$
Time$
WeekDay
Year$

Examples

var$=DateToDate$( "d",30,"12/01/2013") 'returns 12/31/2013
var$=DateToDate$( "yyyy",2,"12/30/2013") 'returns 12/30/2015
var$=DateToDate$( "d",30,date$()) 'returns today's date + 30 days
var$=DateToDate$( "d",-30,date$()) 'returns today's date - 30 days 
var$=DateToDate$( "n",35,date$()+" "+time$()) 'returns system time + 35 mns