how get all sundays in between given 2 dates?

Hi All,

how to get all Sundays in between given 2 dates - Holiday Periods?

  Discussion posts and replies are publicly visible

Parents
  • If you are looking to find the number of Sundays between two dates -

    1. Create a rule called TEST_addNumberToDate with following code

    ri!date + ri!number

    2. Then create another rule -

    with(
      local!count: tointeger(ri!endDate - ri!startDate),
      local!totalDatesInRange: apply(rule!TEST_addNumberToDate(ri!startDate,_),enumerate(local!count)+1),
      local!dayOfTheWeek: apply(fn!weekday,local!totalDatesInRange),
      count(wherecontains(1,dayOfTheWeek))
    )

    If you are looking to find the number of non working days between two dates, try below code -

    with(
     local!int_totalNumberOfDays: tointeger(ri!endDate - ri!startDate),
     local!int_totalNumberOfWorkingDays: calworkdays(ri!startDate,ri!endDate),
     local!int_totalNumberOfNonWorkingDays: local!int_totalNumberOfDays - local!int_totalNumberOfWorkingDays,
     local!int_totalNumberOfNonWorkingDays
    )

Reply
  • If you are looking to find the number of Sundays between two dates -

    1. Create a rule called TEST_addNumberToDate with following code

    ri!date + ri!number

    2. Then create another rule -

    with(
      local!count: tointeger(ri!endDate - ri!startDate),
      local!totalDatesInRange: apply(rule!TEST_addNumberToDate(ri!startDate,_),enumerate(local!count)+1),
      local!dayOfTheWeek: apply(fn!weekday,local!totalDatesInRange),
      count(wherecontains(1,dayOfTheWeek))
    )

    If you are looking to find the number of non working days between two dates, try below code -

    with(
     local!int_totalNumberOfDays: tointeger(ri!endDate - ri!startDate),
     local!int_totalNumberOfWorkingDays: calworkdays(ri!startDate,ri!endDate),
     local!int_totalNumberOfNonWorkingDays: local!int_totalNumberOfDays - local!int_totalNumberOfWorkingDays,
     local!int_totalNumberOfNonWorkingDays
    )

Children