echo $dtBerlin->toCookieString() . "\n";
echo $dtBerlin->toRssString() . "\n";
$dtBerlin->setToStringFormat('l jS \\of F Y');
echo $dtBerlin . "\n";
echo (int) $dtBerlin->isLeapYear() . "\n";
// is* range of functions test
printf("Is yesterday? %s\n", $dtBerlin->isYesterday() ? "yes" : "no");
printf("Is a Thursday? %s\n", $dtBerlin->isThursday() ? "yes" : "no");
printf("Is in the future? %s\n", $dtBerlin->isFuture() ? "yes" : "no");
printf("Is a leap year? %s\n", $dtBerlin->isLeapYear() ? "yes" : "no");
// first and last of the month
printf("First of the month %s\n", $dtBerlin->firstOfMonth());
printf("Last of the month %s\n", $dtBerlin->lastOfMonth());
// nthOf* function test
printf("Start of the month %s\n", $dtBerlin->startOfMonth());
printf("End of the month %s\n", $dtBerlin->endOfMonth());
printf("End of the decade %s\n", $dtBerlin->endOfDecade());
// Date manipulation
print $dtBerlin->addHours(5)->addDays(2)->addWeeks(1)->addMonths(3);
print $dtBerlin->subMonths(8)->subHours(7);
// Find UK Bank Holidays
$dtLondon = CitcoCarbon::today('Europe/London');
list($date, $name) = each($dtLondon->nextBankHoliday());
printf("The next bank holiday is %s on %s\n", $name, $date);
foreach ($dtLondon->getBankHolidays([2016, 2017]) as $date => $name) {
    printf("The next bank holiday is %s on %s\n", $name, $date);
}
// Find end of the current financial year
$fyCalculator = new Calculator(7, 1);
/* FY starts on July 1 */
print $fyCalculator->get($dtBerlin);
Exemple #2
0
 /**
  * @dataProvider data
  */
 public function testGet($fyM, $fyD, $test, $expected)
 {
     $fy = new Calculator($fyM, $fyD);
     $dt = $fy->get(new Carbon($test));
     $this->assertEquals($expected, $dt->format('Y-m-d'));
 }