cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the date of last Saturday of September corresponding to a year

0 Kudos

This is for finding the fiscal year end date. Our Fiscal Year End date is last Saturday of September.

I have a Transaction Date. I have to find the Date of last Saturday of September corresponding to the Year of Transaction Date.

For example if Transaction Date = 17/04/2020, I have to find the date of last Saturday of September 2020.

Can someone please help me on this?

FredericGirod
Active Contributor
0 Kudos

it looks like a training.

the date is, internaly, YYYYMMDD

so date_end_september is = |{ date+0(4) }{ '0931' }|.

after you have to make a loop using DO ENDDO

remove 1 on this day & test the day number.

day number is ( date - '19790101' ) MOD 7 (something like that)

Accepted Solutions (0)

Answers (2)

Answers (2)

ayman_salem
Active Contributor
0 Kudos

If you are working with WebI, define the following variables:

lastDayOfSep: =ToDate("30/09/"+FormatDate([TransDate]; "yyyy");"dd/MM/yyyy")

DateOfLastSat: =RelativeDate([lastDayOfSep]; -(DayNumberOfWeek([lastDayOfSep])+1); DayPeriod)

...

hope this will help you

0 Kudos

last_saturday_sept = case( weekday(3009YYYY),

0, adddays(3009YYYY,-2),

1, adddays(3009YYYY,-3),

2, adddays(3009YYYY,-4),

3, adddays(3009YYYY,-5),

4, adddays(3009YYYY,-6),

5, adddays(3009YYYY,0),

adddays(3009YYYY,-1));

here YYYY is year from transaction date.

Hope it helps