I just wanted to load a different timezone for my application depending on a configuration variable, so I added this method to my Bootstrap:
protected function setTimeZone () {
date_default_timezone_set($timezone);
}
But I'm stuck while trying to load $timezone from the variable named "timezone" in my configs/application.ini file, where I have this:
timezone = "America/Argentina/Cordoba"
Any idea, Thanks!
Try:
$config = $this->getOptions();
date_default_timezone_set($config['timezone']);
Or you may be able to set the timezone directly from the application config with:
phpSettings.date.timezone = "America/Argentina/Cordoba"
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.