Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateDiff() month issue
Message
From
04/10/2011 19:36:21
 
 
To
03/10/2011 21:07:00
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01525500
Message ID:
01525595
Views:
37
>I have a date given such as August 5th, 2007. This is in the tdDate parameter.
>
>I have this code:
>
>
>lnMonth = DateDiff(DateInterval.Month, tdDate, Date.Now)
>
>
>It gives 50. How can it gives 50 if we do not have completed the 2nd month of this fifth year yet? Basically, four years have elapsed. So, that gives 48 months. Then, on September 5th, 2011, this moves it to 49. But, how could it have moved to 50 if we are not October 5th yet?

http://msdn.microsoft.com/en-us/library/b5xbyt6f%28v=VS.90%29.aspx

"...the return value for DateInterval.Month is calculated purely from the year and month parts of the arguments"

Day is not part of the calculation.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform