Home All Groups Group Topic Archive Search About

calculate date in the future

Author
31 Aug 2006 12:49 AM
John Devlon
Hello everyone...

Does anyone know if there is easy way to calculate a certain day in the
future ?

For example: I would like to calculate when the date is 15 days from today
....

I've tried something stuppid like ...

mydate.addDays(15)

.... but that would be to easy ..

Any suggestions

Thanx

John

Author
31 Aug 2006 1:23 AM
Kerry Moorman
John,

That should work. Keep in mind that AddDays returns a new datetime, it does
not add the days to the current datetime value. You should be able to do this:

myDate = myDate.AddDays(15)

Or you could assign the new datetime value into to another variable:

myNewDate = myDate.AddDays(15)

Of course, you could also use the classic VB function DateAdd.

Kerry Moorman


Show quoteHide quote
"John Devlon" wrote:

> Hello everyone...
>
> Does anyone know if there is easy way to calculate a certain day in the
> future ?
>
> For example: I would like to calculate when the date is 15 days from today
> ....
>
> I've tried something stuppid like ...
>
> mydate.addDays(15)
>
> .... but that would be to easy ..
>
> Any suggestions
>
> Thanx
>
> John
>
>
>
>
Author
31 Aug 2006 6:44 AM
Cor Ligthert [MVP]
Kerry,

In my idea is your answer wrong while you describe it well..

>> mydate.addDays(15)

> That should work......................................................
That won't work, it has to be

> myDate = myDate.AddDays(15)

Just for those reading your message.

:-)

Cor
Author
31 Aug 2006 7:06 AM
John Devlon
Thank you  ...

John



Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht
news:uIgVxiMzGHA.4580@TK2MSFTNGP05.phx.gbl...
> Kerry,
>
> In my idea is your answer wrong while you describe it well..
>
>>> mydate.addDays(15)
>
>> That should work......................................................
> That won't work, it has to be
>
>> myDate = myDate.AddDays(15)
>
> Just for those reading your message.
>
> :-)
>
> Cor
>
>
>
>
Author
31 Aug 2006 1:58 AM
Greg
"John Devlon" <johndev***@hotmail.com> wrote in message
news:AmqJg.50418$jR1.755814@phobos.telenet-ops.be...
> Hello everyone...
>
> Does anyone know if there is easy way to calculate a certain day in the
> future ?

Eg. For date 15 days from now....

Dim dFutureDate As Date
dFutureDate = DateAdd(DateInterval.Day,15,Now)

Cheers.