Difetto tra due date

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?

Greetings,
Nicola

Are you talking about 29 days, which is almost 1 month?
Are you assuming a month always has 30 days?

Are you again talking about days? 8 days in months is 0.26

Taifun

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 ???

If the days are 206, and the weeks are 29, why do the months appear to be 0.96667?

What is the first purple block on the left (not the procedure block) the one behind the Do it comment?

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:

EDIT

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

Because you divide the weeks by 30 and not the days

Taifun

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 :upside_down_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.