MeuMySQL Blog is now at

Wednesday, January 9, 2013

PHP: Date Default Timezone

Hi Folks! This is a short article about a common warning we can get when using php without be careful with the settings.  It's quite importante in your application to determine the time zone you are in. If you don't do so, you can get warnings such the one below:

Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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. 

To sort it out just add into your application the function  date_default_timezone_set('value');
As value you can use any of the supported timezones by PHP, they can be found here.



No comments:

Post a Comment