Skip to content

Instantly share code, notes, and snippets.

@ckwalsh
Created March 1, 2014 21:02
Show Gist options
  • Save ckwalsh/9297264 to your computer and use it in GitHub Desktop.
Save ckwalsh/9297264 to your computer and use it in GitHub Desktop.
root@ckwalsh:~# cat foo.php
<?php
$tz = new DateTimeZone('America/Los_Angeles');
$dt = new DateTime(null, $tz);
var_dump($tz);
var_dump($dt);
root@ckwalsh:~# php foo.php
object(DateTimeZone)#1 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(19) "America/Los_Angeles"
}
object(DateTime)#2 (3) {
["date"]=>
string(19) "2014-03-01 13:01:25"
["timezone_type"]=>
int(3)
["timezone"]=>
string(19) "America/Los_Angeles"
}
root@ckwalsh:~# hhvm foo.php
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /root/foo.php on line 4
object(DateTimeZone)#1 (0) {
}
object(DateTime)#2 (0) {
}
root@ckwalsh:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment