Created
February 19, 2014 16:41
-
-
Save davidyell/9095889 to your computer and use it in GitHub Desktop.
Using the PHP DateTime() object
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_default_timezone_set('UTC'); | |
$deadline = '2013-09-13 13:00:00'; // UTC | |
$timezones = array( | |
'America/Los_Angeles', | |
'America/New_York', | |
'UTC', | |
'Europe/London', | |
'Europe/Berlin', | |
'Europe/Minsk' | |
); | |
foreach ($timezones as $timezone) { | |
$t = new DateTime; | |
$t->setTimestamp(strtotime($deadline)); | |
$t->setTimezone(new DateTimeZone($timezone)); | |
var_dump($t); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment