VB NET number of months between 2 dates
Séverine LE ROCH
Hi!I haven't many knowledge in VB NET and I want to calculate the difference between 2 dates.
I know that for difference in days it is:
CType(LD.ParamDateTime(GetData("LD.Par.ToDate"))-CType(Document(DocDate),system.DateTime),system.timespan).Days
But what is the function for the months??
Furthermore can you give me a website where vb net is explained, please?
Thank you
Best regards
Séverine
Philipp Knecht
Hi SéverineBasically MSDN is a very good ressource:
http://msdn.microsoft.com/fr-fr/vbasic/default.aspx
For the month:
CType(LD.ParamDateTime(GetData("LD.Par.ToDate"))-CType(Document(DocDate),system.DateTime),system.timespan).MonthHint:
(You'll get all the properties of this timespan object if you just enter the "." before the Days Property...)
hth
Séverine LE ROCH
Hi PhilippI had already tried this function but it doesn't work. I haven't the possibility to choose "month" after the point.
It gives me this error message:
"Month is not a member of 'System.TimeSpan"
For the moment I do the difference in days and I divide result by 30 but it is not really good
Thank you for the website.
hth
Séverine
Philipp Knecht
Hi SéverineOk i think thats the point. Since it's not clear how long a month is (28,29,30,31 days) this function doesn't make sense.
hth
0
Please sign in to leave a comment.
Comments
0 comments