PHP code example of hamidgh83 / intldatetime
1. Go to this page and download the library: Download hamidgh83/intldatetime 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/ */
hamidgh83 / intldatetime example snippets
$date = new \IntlDateTime\DateTime;
// You can change timezone
$date->setTimezone(new \DateTimeZone('Asia/Tehran'));
// Set an adapter to change calendar type
$date->setAdapter(\IntlDateTime\Adapters\AdapterTypeInterface::TYPE_JALALI);
// Set a Jalali date
$date->setDate(1395, 04, 19);
// Add one day to calculate further date
$interval = new DateInterval('P1D');
$date->add($interval);
echo $date->format("Y/m/d W");
$date = new \IntlDateTime\DateTime('2017-08-01');
// Set an adapter to change calendar type
$date->setAdapter(\IntlDateTime\Adapters\AdapterTypeInterface::TYPE_JALALI);
echo $date->format("Y/m/d W");