In VB coding how to add one to date?

Asked By 0 points N/A Posted on -

In starting a program in Visual Basic I want my dates to be compatible with World Time Zone.

In VB coding how to add one to date and allow functionality in Access?

If it doesn't work for Access, will Excel?

Answered By 0 points N/A #181450

In VB coding how to add one to date?


Hi Kurt Pry,

You can use DateAdd function in VB script to add dates.
Below is the syntax for the same.
DateAdd ( Timeinterval, value, date )
Timeinterval can be of the following types.
yyyy – Year
q – Quarter
m – Month
y – Day of the year
d – Day
w – Weekday
ww – Week
h – Hour
n – Minute
s – Second
Value is the interval you want to add
date is the date to which value will be added
It can be used in VB script
below is a sample code.
Dim NewDate As Date
NewDate = DateAdd ("n", 53, #29/10/2012 10:31:58 AM#)
It is applicable to all versions of Access.
Hope it helps.

Login/Register to Answer

Related Questions