Created
February 13, 2014 06:31
-
-
Save shouhei/8970792 to your computer and use it in GitHub Desktop.
PHP setting timezone example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date_utc = new DateTime(); | |
$date_utc->setTimezone( new DateTimezone('UTC') ); | |
echo preg_replace("/\+/"," +",preg_replace("/T/"," ",$date_utc->format(DATE_ISO8601))).PHP_EOL; | |
$date = new DateTime(); | |
$date->setTimezone( new DateTimezone('Asia/Tokyo') ); | |
echo preg_replace("/\+/"," +",preg_replace("/T/"," ",$date->format(DATE_ISO8601))).PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment