Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15484

Calculate Age-February issue

$
0
0
Hello everybody. I managed to create a function which calculates the age, based on today's date in form of "X years + Y months+ Z days". For example if someone is born at November 23rd 1978, it returns "42 years old + 3 months + 2 days" The only issue i had is when today's month is February. Although i used "DaysInMonth" method to get the days of the current month of the current year, there was a slightly small difference of 3 days in results based in comparison with Windows calculator results. Then, according to my calculations i realized that what Windows Calculator returns, seems to be that is assumed that February has 31 days. I changed that in my function too, and the results are exactly the same. I checked both Windows Calculator with my function, as well as several sites that calculate date difference in the above return type and the results are completely the same. Do you know why this happens? Is there an international convention or something that defines February with 31 days, for these kind of calculations?

Viewing all articles
Browse latest Browse all 15484

Latest Images

Trending Articles



Latest Images