1. Go to this page and download the library: Download maidmaid/phperiod 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/ */
maidmaid / phperiod example snippets
echo Phperiod::period('2016-10-15');
// Saturday, October 15, 2016
echo Phperiod::period('2016-10-15 12:00');
// Saturday, October 15, 2016 at 12:00 PM
echo Phperiod::period('2016-10-15 12:00', '2016-10-15 13:00');
// Saturday, October 15, 2016 from 12:00 PM to 1:00 PM
echo Phperiod::period('2016-10-15', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016
echo Phperiod::period('2016-10-15 12:00', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 at 12:00 PM
echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 from 12:00 PM to 1:00 PM
echo Phperiod::period('2016-10-15', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday, from Saturday, October 15, 2016 to Saturday, October 29, 2016
echo Phperiod::period('2016-10-15 12:00', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday at 12:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016
$formatter = new \IntlDateFormatter('en', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $formatter);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from 10/15/16 to 10/29/16
$fr = new \IntlDateFormatter('fr');
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $fr);
// lundi, jeudi et samedi de 12:00 à 13:00, du samedi 15 octobre 2016 au samedi 29 octobre 2016
// if special keywords don't have translation, they are remplaced by generic
// symbols ('from' and 'to' remplaced by '→'), like with Zulu locale
$zu = new \IntlDateFormatter('zu', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00', [], $zu);
// 10/15/16 → 10/17/16 12:00 Ntambama → 1:00 Ntambama
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.