correct the datediff function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    correct the datediff function

    i am using vb 6 , i had place two datepicker in form now i want to calcuate differcen of month in two date for this i used the function datediff

    i had try it withh many syntax but getting error like

    Code:
     datediff(mm,date1,date2) 
    datediff(mmm,date1,date2)
    datediff(month,date1,date2)
    datediff("mm",date1,date2)
    datediff("mmm",date1,date2)
    datediff("month",date1,date2)
    OR
    datediff("month","date1",date2")
    but always getting error invalid procedure called so what is the correct systax.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    please find a realted article here.

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      You need to assign it to some Integer:

      Dim iMon As Integer
      iMon = datediff("mm",D tp1.Value,dtp2. Value)

      Regards
      Veena

      Comment

      Working...