Hi EveryOne,
I want to find number of weeks in a year(technically) in MS dynamics Ax 2009.If any one have any idea then reply me.
Thanks & Regards
Arun Garg
Hi EveryOne,
I want to find number of weeks in a year(technically) in MS dynamics Ax 2009.If any one have any idea then reply me.
Thanks & Regards
Arun Garg
I got the solution.
static int calendarWeek_DE(Date inputDate)
{
real a = trunc((14 - (mthOfYr(inputDate))) / 12);
real y = year(inputDate) + 4800 - a;
real m = (mthOfYr(inputDate)) + (12 * a) - 3;
real jd;
real d4;
real L;
real dl;
int calendarWeek;
;
jd = str2int(substr(date2str(inputDate, 123, 2, 2, 2, 2, 2), 1, 2)) +
trunc(((153 * m) + 2) / 5) + (365 * y) +
trunc(y / 4) - trunc(y / 100) + trunc (y / 400) - 32045;
d4 = (jd + 31741 - (jd mod 7)) mod 146097 mod 36524 mod 1461;
L = trunc(d4 / 1460);
dl = ((d4 - L) mod 365) + L;
calendarWeek = trunc(dl / 7) + 1;
print calendarWeek;
}
Hi Arun,
Use the function Global::weekOfYear(inputDate) you will get the week in the year…
Global::weekOfYear(inputDate) returns week OF year for inputDate, but not weeks in year
**Global::weekOfYear(**dateEndYr(inputDate)) returns number of weeks in year