PHP code example of lib16 / calendar
1. Go to this page and download the library: Download lib16/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/ */
lib16 / calendar example snippets
Lib16\Calendar\Calendar;
use Lib16\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);
Lib16\Calendar\DateTime;
const LN = "\n";
print new DateTime();
print LN . new DateTime('2017-02-22');
print LN . new DateTime('first day of next month');
Lib16\Calendar\DateTime;
const LN = "\n";
print DateTime::create();
print LN . DateTime::create(new DateTime());
print LN . DateTime::create(new \DateTime());
print LN;
print LN . DateTime::create('2017-02-22');
print LN . DateTime::create('2017-02');
print LN . DateTime::create('22.02.2017');
print LN . DateTime::create('02/22/2017');
print LN . DateTime::create('last day of previous month');
print LN . DateTime::create('first monday of june 2017');
print LN . DateTime::create('now');
print LN;
print LN . DateTime::create(22, 2, 2017);
print LN . DateTime::create(22, 2);
print LN . DateTime::create(22);
print LN . DateTime::create(2017, 2, 22);
print LN . DateTime::create(2017, 2);
print LN . DateTime::create(2017);
Lib16\Calendar\DateTime;
print DateTime::easter(2017);
Lib16\Calendar\DateTime;
const LN = "\n";
print LN . DateTime::create('2016-03-29')->addYears(2);
print LN . DateTime::create('2016-03-29')->addMonths(-2);
print LN . DateTime::create('2016-03-29')->addDays(3);
print LN . DateTime::create('2016-04-01')->forceWorkday();
print LN . DateTime::create('2016-04-02')->forceWorkday();
print LN . DateTime::create('2016-04-03')->forceWorkday();
print LN . DateTime::create('2016-04-04')->forceWorkday();
Lib16\Calendar\DateTime;
$easter = DateTime::easter(2016);
$pentecost = $easter->copy()->addDays(49);
print $pentecost;
Lib16\Calendar\DateTime;
setlocale(LC_TIME, 'de');
$date = DateTime::create('2016-06-05');
print $date->formatLocalized('%A, %#d. %B %Y');
Sun, 15 May 2016 00:00:00 +0200