Skip to main content
Known Participant
Mar 27, 2023 5:27 AM UTC
Solved

To find if a given date lies in the last week of the month

Hi,

I need to find out if a given date is in the last week of the month.  For example 27th of March 2023 is in the last week of the March month.  How can I achieve this?  Please give me the suggestions.

Thanks and Regards,

Brinda Sateesh

    sanchitg0002
    Inspiring
    Mar 27, 2023 5:43 AM UTC

    This should work.

    a!localVariables(
      local!monthEndDay: weekday(eomonth(ri!date, 0), 3),
      local!endWeekStartDate: eomonth(ri!date, 0) - local!monthEndDay,
      or(ri!date >= local!endWeekStartDate)
    )

    2 replies

    sanchitg0002
    Inspiring
    Mar 27, 2023 5:43 AM UTC

    This should work.

    a!localVariables(
      local!monthEndDay: weekday(eomonth(ri!date, 0), 3),
      local!endWeekStartDate: eomonth(ri!date, 0) - local!monthEndDay,
      or(ri!date >= local!endWeekStartDate)
    )

    brindasAuthor
    Known Participant
    Mar 27, 2023 6:03 AM UTC

    It worked.  Thank you.