- time: documentation ( source)
- print_r: documentation ( source)
- date: documentation ( source)
- date_default_timezone_get: documentation ( source)
<?php
echo 'date_default_timezone_get(): ' . print_r(date_default_timezone_get(), true) . "\n";
$ts = time();
echo '$ts: ' . print_r($ts, true) . "\n";
echo 'date(\'c\', $ts): ' . print_r(date('c', $ts), true) . "\n";
$datetime = new \Datetime(date('c', $ts));
echo '$datetime: ' . print_r($datetime, true) . "\n";
$datetime = new \Datetime('@' . $ts);
echo '$datetime: ' . print_r($datetime, true) . "\n";
$datetime = new \Datetime('@' . $ts);
$datetime->setTimezone(new \DateTimeZone(date_default_timezone_get()));
echo '$datetime: ' . print_r($datetime, true) . "\n";