Skip to main content
March 27, 2023
Solved

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

  • March 27, 2023
  • 2 replies
  • 0 views

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

    Best answer by sanchitg0002

    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

    March 27, 2023

    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
    March 27, 2023

    It worked.  Thank you.