Skip months within specific months range within given interval

Excercise is to have below output -

02/06/2021

02/08/2021

02/10/2021

02/12/2021

Startdate 02/06/2021

Enddate   20/12/2021

Noofintervals 2 months

any idea to achieve this?

  Discussion posts and replies are publicly visible

Parents
  • Try this out for size.  The edate() function is useful for adding straight months.

    a!localVariables(
      local!startDate: date(2021,06,02),
      local!endDate: date(2021,12,20),
      local!monthIntervals: 2,
      local!monthsBetween: month(local!endDate)-month(local!startDate)+12*(year(local!endDate)-year(local!startDate)),
      {
        local!startDate,
        reject(
          rule!APN_isEmpty,
          a!forEach(
            items: 1+enumerate(local!monthsBetween),
            expression: if(
              mod(fv!index,local!monthIntervals)=0,
              edate(local!startDate,fv!item),
              null
            )
          )
        )
      }
    )

Reply
  • Try this out for size.  The edate() function is useful for adding straight months.

    a!localVariables(
      local!startDate: date(2021,06,02),
      local!endDate: date(2021,12,20),
      local!monthIntervals: 2,
      local!monthsBetween: month(local!endDate)-month(local!startDate)+12*(year(local!endDate)-year(local!startDate)),
      {
        local!startDate,
        reject(
          rule!APN_isEmpty,
          a!forEach(
            items: 1+enumerate(local!monthsBetween),
            expression: if(
              mod(fv!index,local!monthIntervals)=0,
              edate(local!startDate,fv!item),
              null
            )
          )
        )
      }
    )

Children