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:

  1. set default timezone in php script using date_default_timezone_set():

    date_default_timezone_set("america/los_angeles"); 
  2. use ini_set() set default timezone:

    ini_set('date.timezone', 'america/los_angeles');  
  3. define date.timezone in php.ini file.

documentation: date_default_timezone_set() ini_set()

hope helps!


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -