- var_dump: documentation ( source)
- date_default_timezone_set: documentation ( source)
- date_default_timezone_get: documentation ( source)
<?php
echo date_default_timezone_get() . PHP_EOL;
date_default_timezone_set('UTC');
$date1 = new DateTime("@1442862000");
var_dump($date1->getTimestamp()); //prints: 1442862000
echo $date1->format(DATE_RFC822 . " e T O"), "\n";
$date1->setTimezone(new DateTimeZone("Asia/Tehran"));
var_dump($date1->getTimestamp()); //prints: 1442865600
echo $date1->format(DATE_RFC822 . " e T O"), "\n";
$next = 1442862000 + 60 * 60;
$date1 = new DateTime("@$next");
var_dump($date1->getTimestamp()); //prints: 1442862000
echo $date1->format(DATE_RFC822 . " e T O"), "\n";
$date1->setTimezone(new DateTimeZone("Asia/Tehran"));
var_dump($date1->getTimestamp()); //prints: 1442865600
echo $date1->format(DATE_RFC822 . " e T O"), "\n";