DateToDate$

Date/Time function.

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

Usage

It can return a date at 30 days from today, a time at 1h45 from now, ...

Syntax

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

Parameters

<interval$>, string specifying the time interval you want to add to <date$>.
 

<interval$> value

Unit of time difference

d

Day

w

Weekday

ww

Week (number of weeks)

y

Day of the year

yyyy

Year (number of years)

q

Quarter (number of quarters)

m

Month (number of months)

h

Hours (number of hours)

n

Minutes (number of minutes)

s

Seconds (number of seconds)

<number>, integer, number of interval you want to add. Can be positive, for dates in the future or negative, for dates in the past.

<date$>, string, date to which <interval$> is added

Return value

Returns a string, the date to which the specified datetime interval has been added.

Remarks

The returned date always uses the Regional Settings date/time format.

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

Examples

 

var$=DateToDate$( "d",30,"12/01/2007") 'returns 12/31/2007

var$=DateToDate$( "y",2,"12/30/2007") 'returns 12/30/2009

var$=DateToDate$( "d",30,date$()) 'returns the date 30 days after today

var$=DateToDate$( "d",-30,date$()) 'returns the date 30 days before today