date - PHP mktime() error -
i'm of sudden getting following error on site i've done when import excel file mysql using excel_reader library.
this error message mktime()
produces:
message: mktime() [function.mktime]: not safe rely on system's timezone settings. required use date.timezone setting or date_default_timezone_set() function. in case used of methods , still getting warning, misspelled timezone identifier. selected 'asia/krasnoyarsk' '7.0/no dst' instead
the error because of following line:
$string = date ($format, mktime($hours, $mins,$secs, $dateinfo["mon"], $dateinfo["mday"], $dateinfo["year"]));
i'm using php version 5.3.1. script not compatible php version? how can fix error?
the error says all. relying on system's timezone settings bad idea , therefore 'll need specify timezone using 1 of following options.
you have 3 solutions:
set default timezone in php script using
date_default_timezone_set()
:date_default_timezone_set("america/los_angeles");
use
ini_set()
set default timezone:ini_set('date.timezone', 'america/los_angeles');
- define
date.timezone
inphp.ini
file.
documentation: date_default_timezone_set()
ini_set()
hope helps!
Comments
Post a Comment