Hello everyone,
Basically, in image 1, although the time elapsed between two dates corresponds to 29 weeks, when expressed in months, it comes out as 0.96667, which, with just one decimal place, equals 1.0.
In image 2, however, the time elapsed between two dates corresponds to 8 weeks, while when expressed in months, it comes out as 0.3. Where am I going wrong in my calculations?
Looking at your first example you are continuously overwriting your LblGiorniVitD, which I presume originally contained the difference between two dates in days, but after initial division by 7 ( and truncation ) it contains the difference in weeks, but after subsequent divisions by 30 and 365 it contains ???
Also whatever you are dividing by 30 (a month in days) will not give you a totally accurate answer, but you know that ? You could get a bit closer with this:
You could always work it another way (on average):
52.18 weeks in a year (365.25 / 7 - includes 0.25 for leap year)
52.18 / 12 = 4.35 weeks in a month
0.35 * 7 = 2.45 days
4 x 7 + 2.45 = 30.45 number of days in a month
I finally solved the problem by using variables to perform the various operations as you told me some time ago..the thing is that sometimes I forget and go to use the labels