Skip to content

Instantly share code, notes, and snippets.

@davidyell
Created February 19, 2014 16:41
Show Gist options
  • Save davidyell/9095889 to your computer and use it in GitHub Desktop.
Save davidyell/9095889 to your computer and use it in GitHub Desktop.
Using the PHP DateTime() object
<?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