I'm trying to get DateTimeZone object, setting it the following way:
$dateTimeZoneRemote = new DateTimeZone('America/Edmonton');
However printing it out returns an empty object??
print_r( $dateTimeZoneRemote );
returns:
DateTimeZone Object ( )
Running PHP 5.2.17
The problem here is that print_r
/ var_dump
/ get_object_vars
don't show the properties of DateTimeZone as you expect. This was a bug , fixed in PHP 5.5.
Whatever, using the methods that the class provide, you get the correct result in any version.
$dateTimeZoneRemote = new DateTimeZone('America/Edmonton');
echo $dateTimeZoneRemote->getName(); // print America/Edmonton
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.