mambax7/extcal

View on GitHub
class/pear/Calendar/docs/examples/19.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/**
 * Description: demonstrates using the Weekday decorator.
 */
if (!@require_once __DIR__ . '/Calendar/Calendar.php') {
    define('CALENDAR_ROOT', '../../');
}
require_once CALENDAR_ROOT . 'Day.php';
require_once CALENDAR_ROOT . 'Decorator/Weekday.php';

$Day     = new Calendar_Day(date('Y'), date('n'), date('d'));
$WeekDay = new Calendar_Decorator_Weekday($Day);
// $WeekDay->setFirstDay(0); // Make Sunday first Day

echo 'Yesterday: ' . $WeekDay->prevWeekDay() . '<br>';
echo 'Today: ' . $WeekDay->thisWeekDay() . '<br>';
echo 'Tomorrow: ' . $WeekDay->nextWeekDay() . '<br>';

$WeekDay->build();
echo 'Hours today:<br>';
while (false !== ($Hour = $WeekDay->fetch())) {
    echo $Hour->thisHour() . '<br>';
}