- date_default_timezone_set: documentation ( source)
- date_default_timezone_get: documentation ( source)
<?php
date_default_timezone_set('UTC');
echo date_default_timezone_get(), PHP_EOL;
$time = DateTime::createFromFormat('Y-m-d H:i:s', '2014-05-19 11:30:00');
foreach (['UTC', 'Europe/London', 'BST', 'Etc/GMT+1', 'GMT+1', 'CEST'] as $abbr) {
try {
$time->setTimezone(new DateTimeZone($abbr));
echo "{$abbr}: {$time->format(DATE_RFC822)}", PHP_EOL;
} catch (Exception $e) {
echo "{$abar}: ERROR - {$e->getMessage()}";
}
}