Skip to content

Instantly share code, notes, and snippets.

@peerapongsam
Created November 19, 2015 03:12
Show Gist options
  • Save peerapongsam/7600718b0de16bf1235c to your computer and use it in GitHub Desktop.
Save peerapongsam/7600718b0de16bf1235c to your computer and use it in GitHub Desktop.
<?php
$input = "2015-08-21 05:55:19 GMT";
$gmt_date = DateTime::createFromFormat(
'Y-m-d H:i:s T',
$input);
$ict_date = clone $gmt_date;
$ict_date->setTimeZone(new DateTimeZone('Asia/Bangkok'));
echo 'GMT: ' . $gmt_date->format('Y-m-d H:i:s P');
echo "<br/>\n";
echo "ICT: " . $ict_date->format('Y-m-d H:i:s P');
echo "<br>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment