PHP code example of clacy-builders / calendar
1. Go to this page and download the library: Download clacy-builders/calendar 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/ */
clacy-builders / calendar example snippets
\ClacyBuilders\Calendar\Calendar;
use \ClacyBuilders\Calendar\DateTime;
setlocale(LC_TIME, 'de');
$easter = DateTime::easter(2016);
$calendar = Calendar::month(5, 2016)
->setMonthFormat('%b %Y')
->setFirstWeekday('DE')
->addEntry('2016-05-01', 'Tag der Arbeit')
->addEntry($easter->copy()->addDays(39), 'Christi Himmelfahrt')
->addEntry($easter->copy()->addDays(50), 'Pfingstmontag')
->addEntry($easter->copy()->addDays(60), 'Fronleichnam');
print json_encode($calendar->buildArray(), JSON_PRETTY_PRINT);
use \ClacyBuilders\Calendar\DateTime;
$days[] = new DateTime('2016-03-29');
$days[] = new DateTime();
$days[] = new DateTime('first day of next month');
$days[] = DateTime::create(29, 3, 2016);
$days[] = DateTime::create(29, 3);
$days[] = DateTime::create(29);
$days[] = DateTime::create(2016, 3, 29);
$days[] = DateTime::create(2016, 3);
$days[] = DateTime::create(2016);
$days[] = DateTime::create();
$days[] = DateTime::create('2016-03-29');
$days[] = DateTime::create('2016-03');
$days[] = DateTime::create('29.03.2016');
$days[] = DateTime::create('03/29/2016');
$days[] = DateTime::create('last day of previous month');
$days[] = DateTime::easter(2016);
$days[] = DateTime::create('2016-03-29')->addYears(2);
$days[] = DateTime::create('2016-03-29')->addMonths(-2);
$days[] = DateTime::create('2016-03-29')->addDays(3);
$days[] = DateTime::create('2016-04-01')->forceWorkday();
$days[] = DateTime::create('2016-04-02')->forceWorkday();
$days[] = DateTime::create('2016-04-03')->forceWorkday();
$days[] = DateTime::create('2016-04-04')->forceWorkday();
$easter = DateTime::easter(2016);
$pentecost = $easter->copy()->addDays(49);
setlocale(LC_TIME, 'de');
$date = DateTime::create('2016-06-05');
print $date->formatLocalized('%A, %#d. %B %Y');
Sun, 27 Mar 2016 00:00:00 +0100
Sun, 15 May 2016 00:00:00 +0200