How can i run this code on PHP 5.1.6
$tz = new DateTimeZone($obj['timezone']);
without upgrading my PHP version?
or is there any alternative?
I'am getting this error
PHP Fatal error: Class 'DateTimeZone' not found
Thank you
How can i run this code on PHP 5.1.6
$tz = new DateTimeZone($obj['timezone']);
without upgrading my PHP version?
or is there any alternative?
I'am getting this error
PHP Fatal error: Class 'DateTimeZone' not found
Thank you
PHP 5.1.x has only experimental support for DateTime
http://php.net/manual/en/datetime.installation.php
Note: Experimental DateTime support in PHP 5.1.x
Although the DateTime class (and related functions) are enabled by default since PHP 5.2.0, it is possible to add experimental support into PHP 5.1.x by using the following flag before configure/compile: CFLAGS=-DEXPERIMENTAL_DATE_SUPPORT=1
date_default_timezone_set('America/Los_Angeles'); //set your timezone
$tz = date_default_timezone_get(); //display timezone
$date = date('Y:m:d'); //display date