Date difference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zile

    #1

    Date difference

    How can I calculate date-number of days?
    Example:

    Dim FirstDate as Date
    Dim SecondDate as Date

    FirstDate="01.1 2.2006"
    SecondDate=Firs tDate+2 '1 is number of days and I must get "03.12.2006 "

    or

    SecondDate=Firs tDate-5 ' and I will get "26.11.2006 "

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


  • Michael Schwarz

    #2
    Re: Date difference

    SecondDate = FirstDate.AddDa ys(2)
    SecondDate = FirstDate.AddDa ys(-5)

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

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







    "Zile" <bozidarm@yahoo .comschrieb 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.1 2.2006"
    SecondDate=Firs tDate+2 '1 is number of days and I must get "03.12.2006 "
    >
    or
    >
    SecondDate=Firs tDate-5 ' and I will get "26.11.2006 "
    >
    But it's not work! How can I calculate with dates in VB 2005?
    >

    Comment

    Working...