Skip to Content
0
Former Member
Nov 04, 2015 at 01:17 PM

Javascript to calculate previous six months

35 Views

I need help with the Javascript to calculate the previous six months based on the current month. I tried using the While statement but that does not seem to be a valid statement in Design Studio. The data I am reading does not always have data for every month so I cannot use an array of the 0CALMONTH values. I want to do something like this (syntax is not correct just pseudo).

var month = APPLICATION.getInfo().dateNowInternalFormat.substring(4,2);

var year = APPLICATION.getInfo().dateNowInternalFormat.substring(0,4);

While (i < 6) {

month = month - 1;

if month > 1;

month = 12;

year = year - 1;

endif.

i++;

}

Thanks.

Sandy