6 Replies Latest reply: Jul 24, 2013 2:52 AM by Ori Tal

# sum of month between from and to date

hi guys,

Is there any posibility can we some the  no. of month between from and to date.

After selecting from and to date no. of month should be calculated.

e.g

if i select from date - 01/01/2011 and to date-01/07/2013 (format of date is dd/mm/yyyy) in slider/calender.

so no. of is 31 month is the answer.

• ###### Re: sum of month between from and to date

try this:

Ceil((Date1-Date2)/30)

• ###### Re: sum of month between from and to date

Hi tres,

Its a dynamic date selection in slider/calender based on that the expression should sum the no. of month between from and to date.

• ###### Re: sum of month between from and to date

so, store the two dates(from and to) in two variables and then use the functions as above. right?

Ceil((Variable1-Variable2)/30)

• ###### Re: sum of month between from and to date

Use these part as script....

FromDate,ToDate
01/04/2013,05/07/2013
10/06/2013,06/08/2013
01/01/2011,01/07/2013
];

Date:
Date(FromDate,'DD/MM/YYYY') as %FromDate,
Date(ToDate,'DD/MM/YYYY') as %ToDate

In UI part:

Take Two List box %FromDate and %ToDate

and use a expression in a text object which is...

='Difference : '&((year(%ToDate) * 12) + month(%ToDate) - (((year(%FromDate) * 12) + month(%FromDate))) + 1)

check these....

• ###### Re: sum of month between from and to date

thanks it's work

• ###### Re: sum of month between from and to date

Try This:

Num#(Year(Date1)&Month(Date1))-Num#(Year(Date2)&Month(Date2))

See attached example