PHP code example of kronos / rrule

1. Go to this page and download the library: Download kronos/rrule library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kronos / rrule example snippets


$rrule = new \Kronos\RRule();
$rrule->setByDay(array(\Kronos\RRule\Enums\Days::FRIDAY));
$rrule->setByHour(array('1'));
$rrule->setByMinute(array('1'));
$rrule->setByMonth(array('1'));
$rrule->setByMonthDay(array('1'));
$rrule->setBySecond(array('1'));
$rrule->setBySetPos(array('1'));
$rrule->setByWeekNo(array('1'));
$rrule->setByYearDay(array('1'));
$rrule->setCount(1);
$rrule->setFrequency(\Kronos\RRule\Enums\Frequencies::DAILY);
$rrule->setInterval(1);
$rrule->setUntil(new \DateTime('1980-08-08'));
$rrule->setWkst(\Kronos\RRule\Enums\Days::MONDAY);

echo $rrule->generateRawRRule();

$raw_rrule = 'RRULE:BYMONTHDAY=20,21';
$rrule = \Kronos\RRule::fromRawRRule($raw_rrule);

$timezone = new \DateTimeZone('UTC');
$exdate->setExceptionDates([
	new \DateTime('2000-01-01 00:00:00', $timezone),
	new \DateTime('2000-02-01 01:00:00', $timezone),
]);

echo $exdate->generateRawExDate();