1. Go to this page and download the library: Download phphleb/calendar-stub 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/ */
phphleb / calendar-stub example snippets
use Phphleb\CalendarStub\DateNameToPeriodConverter;
$converter = new DateNameToPeriodConverter();
// Получение даты за календарный месяц назад от текущего времени.
// Возможные значения периода: 'day', 'week', 'month', 'quarter', 'year', 'all'
// Период может быть кратным, например '2 months'.
// Методы getStartDate и getEndDate возвращают объект DateTime.
$date = $converter
->setPeriodName('month')
->getStartDate()
->format('Y-m-d H:i:s');
// Получение даты два календарных месяца назад от текущего времени.
$date = $converter
->setPeriodName('2 months')
->getStartDate()
->format('Y-m-d H:i:s');
// Получение даты два календарных месяца вперед от текущего времени.
$date = $converter
->setPeriodName('2 months')
->setStartDate(new DateTime())
->getEndDate()
->format('Y-m-d H:i:s');
// Получение даты два календарных месяца назад от заданного времени (28го февраля 2017).
$endPeriod = new DateTime('2017-02-28 00:00::00');
$date = $converter
->setPeriodName('2 months')
->setEndDate($endPeriod)
->getStartDate()
->format('Y-m-d H:i:s');
// При задании периода "all" ничего не рассчитывается, так как возвращается или
// start date от начала UNIX Time, так и уже установленная end date или текущее время.
$date = $converter
->setPeriodName('all')
->getEndDate()
->format('Y-m-d H:i:s');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.