By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

correct the datediff function

P: 284
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

Expand|Select|Wrap|Line Numbers
  1.  datediff(mm,date1,date2) 
  2. datediff(mmm,date1,date2)
  3. datediff(month,date1,date2)
  4. datediff("mm",date1,date2)
  5. datediff("mmm",date1,date2)
  6. datediff("month",date1,date2)
  7. OR
  8. datediff("month","date1",date2")
but always getting error invalid procedure called so what is the correct systax.
Jul 6 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,127
please find a realted article here.
Jul 7 '08 #2

Expert 100+
P: 1,445

You need to assign it to some Integer:

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

Jul 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.