Page 1 of 1

getdate() error

Posted: Wed Oct 10, 2007 5:07 am
by lettie_dude
Hi

Has anyone come across this error when using the getdate() function.

error occurred in pathtourl:getdate() [function.getdate]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for 'BST/1.0/DST' instead.

The code is straight forward as below. I am only looking to get the current year nothing more nothing less!

Code: Select all

$currentdate = getdate();
$currentyear = $currentdate['year'];
I've looked on php.net to see if the function was now depricated but it mentions nothing about this error.

Any clues would be most helpful.

Cheers

Posted: Wed Oct 10, 2007 5:46 am
by N1gel
I think this should get you the current year

Code: Select all

$currentyear = date("Y") //should give you the current year.

date()

Posted: Wed Oct 10, 2007 5:57 am
by lettie_dude
Same error I'm afraid.

Resolved

Posted: Wed Oct 10, 2007 6:41 am
by lettie_dude
Apparently there has been a problem with getdate() and date() since php 5. The answer or work around however you want to look at it is here. Hope this helps someone else it's solved my problem.

http://uk.php.net/manual/en/function.da ... ne-set.php