How to calculate the date of Monday of the week if you know the week number of the year?

Updated: 27.07.2014

Solution:

static TransDate getMondayDateByWeek(Week _week)
{
TransDate transDate;
TransDate firstJanuary = mkDate(1, 1, year(systemDateGet()));
int firstDayofWeek = dayOfWk(firstJanuary);
int dayOfYear;
;
if (_week == 1)
return firstJanuary;

dayOfYear = 7 - firstDayofWeek + 1 + (7 * (_week - 1)) - 7;

transDate = dateStartYr(systemDateGet()) + dayOfYear;
return transDate;
}

 

Other blog posts

24.05.2018
Disclaimer
08.05.2018
We apply OKR methodology in Neti since 2014. We started from a quarterly planning, but then understood that no ambitious goals can be achieved per quarter. So we switched to semi-annual intervals....
11.04.2018
As you know, Microsoft recently has launched Dynamics 365 Business Central. And we are proud to announce we have launched intracompany training for sales and development departments:Why do we need it...

Subscribe for blog updates

Get updated with our blog new articles via your email!


Subscribe now