PHP code example of mynameiszanders / when
1. Go to this page and download the library: Download mynameiszanders/when 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/ */
mynameiszanders / when example snippets
use \When\DateTime as When;
// friday the 13th for the next 5 occurences
$r = new When('19980213T090000');
$occurences = $r->freq(When::MONTHLY)
->count(5)
->byday(When::FRIDAY)
->bymonthday(13)
->generate();
print_r($occurences);
use \When\DateTime as When;
// friday the 13th for the next 5 occurences rrule
$r = new When();
$occurences = $r->startDate(new DateTime('19980213T090000'))
->rule("FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13")
->generate();
print_r($occurences);