rrule

2 weeks ago

DanielDarrenJones

Code

$ruleString =
    "FREQ=WEEKLY;COUNT=2;DTSTART=20200518T170000;DTEND=20200518T172000;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU";

// $startDate = new \DateTime('2014-06-17 04:00:00');
$rule = new \Recurr\Rule($ruleString);
$transformer = new \Recurr\Transformer\ArrayTransformer();

dd($transformer->transform($rule));

Output

Recurr\RecurrenceCollection {#1640
  -elements: array:2 [
    0 => Recurr\Recurrence {#1643
      #start: DateTime @1589821200 {#1649
        date: 2020-05-18 17:00:00.0 UTC (+00:00)
      }
      #end: DateTime @1589821200 {#1651
        date: 2020-05-18 17:00:00.0 UTC (+00:00)
      }
      #index: 1
    }
    1 => Recurr\Recurrence {#1641
      #start: DateTime @1589907600 {#1650
        date: 2020-05-19 17:00:00.0 UTC (+00:00)
      }
      #end: DateTime @1589907600 {#1642
        date: 2020-05-19 17:00:00.0 UTC (+00:00)
      }
      #index: 2
    }
  ]
}