How to Display Dates based on day eg: Sunday

Hi all,

I am new to AX, i want to display dates based on a day(sunday) in a particular Month or a Year,

Is any one there to help me to solve this solution.



Could you elaborate a little bit what you want to display? And what’s your version of AX?

For example in a month we have 4 Sundays, so i want to display the dates of 4 Sundays automatically in that month…

You can calculate dates by something like this:

int yr = 2014;
int mth = 1;
date start = mkDate(1, mth, yr);
date last = endmth(start);
date d = start + 7 - dayOfWk(start);
while (d <= last)
    d += 7; 

If you need help with displaying, you’ll have to explain what you’re trying to achieve.

Thank you so much Martin,

Code has worked, got the output as expected.