Bagi anda yang mempunyai masalah atau warning, berikut cara setting Time Zone untuk PHP 5.3.0,
biasanya error yang dijumpai di website adalah seperti ini:

    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 ‘Asia/Jakarta’ for ‘WIT/7.0/no DST’ instead in /home/xxxxxx/public_html/config.php on line 99

dari error diatas dapat diartikal bahwa ada kesalahan pada timezone setting jadi kita harus melakukan setting sesuai yang di infokan.

    We selected ‘Asia/Jakarta’ for ‘WIT/7.0/no DST’ instead in /home/xxxxxx/public_html/config.php on line 99

ini menandakan bahwa skrip website anda memilih setting waktu ‘Asia/Jakarta’  sehingga kita harus menyesuaikan dengan setting waktu yang ada di skrip  website kita.

Caranya adalah sebagai berikut:

Buka file php.ini, jika file blm ada anda bisa create new file php.ini

    date.timezone = {tulis timezone disini}

contohnya bila di indonesia menggunakan time zone berikut:

    date.timezone =  Asia/Jakarta

kemudian Save file php.ini dan selesai

If you notice the incorrect time in your PHP scripts, the likely culprit is that the hosting server is in a different timezone.

For example, when you’re an InMotion web hosting customer, you can select from data centers in Washington, D.C., or California, which means the server’s timezone will be either Eastern Standard Time (EST) or Pacific Standard Time (PST).

If you want to change that, it’s a quick fix. Simply insert a line of code into your php.ini file and the location you set in the code will determine the time to display in your PHP scripts. Keep reading to learn how.

  1. Open your php.ini file with the File Manager in cPanel .
  2. Add the following line of code to top of your php.ini file: date.timezone = "US/Central".

  3. Replace US/Central with the timezone from here that corresponds to the time you want to display.
  4. Once you have entered the desired timezone, click Save Changes to save the file.

  5. Now, you can check your phpinfo.php page to verify the change took place.

Drag the arrow to the right to see the change in the timezone setting

Congratulations! You are now able to set the timezone in PHP. If you wish to see more guides with tips and information for your website issues, please see our InMotion Hosting Support Center!

Sell hosting using your own brand with a powerful Reseller Hosting plan, now with more resources and faster storage using SSDs at no extra cost.

Arnel Custodio Content Writer I

As a writer for InMotion Hosting, Arnel has always aimed to share helpful information and provide knowledge that will help solve problems and aid in achieving goals. He's also been active with WordPress local community groups and events since 2004.

More Articles by Arnel