PHP Warning: date(): It is not safe to rely on the system’s timezone settings.

On Apache error.log

...PHP Warning:  date(): 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. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\\port\\Apache24-2.4.9\\htdocs\\index.html on line 34

Use on of this :
1. Edit php.ini, then restart Apache

; Defines the default timezone used by the date functions
date.timezone = Asia/Jakarta

2. If your php.ini cannot be edit, you can use this function at the beginning of code

date_default_timezone_set('Asia/Jakarta');//or change to whatever timezone you want

3. Edit index.php without edit php.ini

if( ! ini_get('date.timezone') )

4. If you can’t modify php.ini, and don’t want to add a date_default_timezone call, then use gmdate()

<? print(gmdate("Y")); ?>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: