14,970
edits
mNo edit summary |
|||
| Line 44: | Line 44: | ||
=== PHP way: convert to date time from unix timestamp === | === PHP way: convert to date time from unix timestamp === | ||
Using the [https://www.php.net/manual/en/function.date.php date()] function | Using the [https://www.php.net/manual/en/function.date.php date()] function & [https://www.php.net/manual/en/function.date-default-timezone-set.php date_default_timezone_set] | ||
<pre> | <pre> | ||
date_default_timezone_set('UTC'); | |||
$timestamp = 0; | |||
echo date('Y-m-d H:i:s', $timestamp) . PHP_EOL; // 1970-01-01 00:00:00 | |||
date_default_timezone_set("Europe/London"); | date_default_timezone_set("Europe/London"); | ||
$timestamp = 1552521600; | $timestamp = 1552521600; | ||
| Line 54: | Line 58: | ||
echo date('Y-m-d H:i:s', $timestamp) . PHP_EOL; // 2019-03-14 08:00:00 | echo date('Y-m-d H:i:s', $timestamp) . PHP_EOL; // 2019-03-14 08:00:00 | ||
</pre> | </pre> | ||
=== PHP way: convert to unix timestamp from date time === | === PHP way: convert to unix timestamp from date time === | ||