Home All Groups Group Topic Archive Search About
Author
22 Dec 2006 1:57 PM
andrewbda@gmail.com
quick question here.

I have a date variable that I would like to change. I need to add 364
days to it, i.e. I need year+1, day-1.

any help is appreciated!

Thanks

Author
22 Dec 2006 2:22 PM
vbnetdev
Dim todaysdate As Date = Date.Now
MsgBox(todaysdate.AddDays(364))

<andrew***@gmail.com> wrote in message
Show quoteHide quote
news:1166795871.831525.49430@42g2000cwt.googlegroups.com...
> quick question here.
>
> I have a date variable that I would like to change. I need to add 364
> days to it, i.e. I need year+1, day-1.
>
> any help is appreciated!
>
> Thanks
>
Author
22 Dec 2006 2:25 PM
Martin
How about

Dim MyDate As Date = Date.Today
MyDate = MyDate.AddDays(364)

HTH

Martin

<andrew***@gmail.com> wrote in message
Show quoteHide quote
news:1166795871.831525.49430@42g2000cwt.googlegroups.com...
> quick question here.
>
> I have a date variable that I would like to change. I need to add 364
> days to it, i.e. I need year+1, day-1.
>
> any help is appreciated!
>
> Thanks
>
Author
22 Dec 2006 3:32 PM
Mudhead
Dim dt As Date = Date.Today.AddDays(364)

Show quoteHide quote
"Martin" <mar***@martin.com> wrote in message
news:hVRih.22088$z01.10453@newsfe3-gui.ntli.net...
> How about
>
> Dim MyDate As Date = Date.Today
> MyDate = MyDate.AddDays(364)
>
> HTH
>
> Martin
>
> <andrew***@gmail.com> wrote in message
> news:1166795871.831525.49430@42g2000cwt.googlegroups.com...
>> quick question here.
>>
>> I have a date variable that I would like to change. I need to add 364
>> days to it, i.e. I need year+1, day-1.
>>
>> any help is appreciated!
>>
>> Thanks
>>
>
>
Author
22 Dec 2006 4:15 PM
Stephany Young
It would be nice and easy to use DateTime.Now.AddDays(364) but this would
give a result that is a day short where a leap year is involved.

To be leap year safe, you need to use:

  DateTime.Now.AddYears(1).AddDays(-1)


<andrew***@gmail.com> wrote in message
Show quoteHide quote
news:1166795871.831525.49430@42g2000cwt.googlegroups.com...
> quick question here.
>
> I have a date variable that I would like to change. I need to add 364
> days to it, i.e. I need year+1, day-1.
>
> any help is appreciated!
>
> Thanks
>
Author
22 Dec 2006 4:38 PM
vbnetdev
Your right. I am wrong. Listen to this.

Sorry about that.

Show quoteHide quote
"Stephany Young" <noone@localhost> wrote in message
news:eun6oReJHHA.4112@TK2MSFTNGP04.phx.gbl...
> It would be nice and easy to use DateTime.Now.AddDays(364) but this would
> give a result that is a day short where a leap year is involved.
>
> To be leap year safe, you need to use:
>
>  DateTime.Now.AddYears(1).AddDays(-1)
>
>
> <andrew***@gmail.com> wrote in message
> news:1166795871.831525.49430@42g2000cwt.googlegroups.com...
>> quick question here.
>>
>> I have a date variable that I would like to change. I need to add 364
>> days to it, i.e. I need year+1, day-1.
>>
>> any help is appreciated!
>>
>> Thanks
>>
>
>