Home All Groups Group Topic Archive Search About
Author
20 Nov 2006 3:01 PM
Zile
How can I calculate date-number of days?
Example:

Dim FirstDate as Date
Dim SecondDate as Date

FirstDate="01.12.2006"
SecondDate=FirstDate+2  '1 is number of days and I must get "03.12.2006"

or

SecondDate=FirstDate-5 ' and I will get "26.11.2006"

But it's not work! How can I calculate with dates in VB 2005?

Author
20 Nov 2006 3:05 PM
Michael Schwarz
SecondDate = FirstDate.AddDays(2)
SecondDate = FirstDate.AddDays(-5)

--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/




Show quoteHide quote
"Zile" <bozid***@yahoo.com> schrieb im Newsbeitrag
news:ejsfvl$vgo$1@sunce.iskon.hr...
> How can I calculate date-number of days?
> Example:
>
> Dim FirstDate as Date
> Dim SecondDate as Date
>
> FirstDate="01.12.2006"
> SecondDate=FirstDate+2  '1 is number of days and I must get "03.12.2006"
>
> or
>
> SecondDate=FirstDate-5 ' and I will get "26.11.2006"
>
> But it's not work! How can I calculate with dates in VB 2005?
>