How to change the date.timezone value in PHP?

If your PHP scripts do not show the correct time, the reason is that most probably your hosting server is in a different timezone. This can be easily resolved by changing a setting in PHP called date.timezone.

Depending on your location you can set a specific date.timezone value in PHP using the following option which should be added to your local php.ini file:

date.timezone = "US/Central"

The above example assumes you'd like to set the timezone for your PHP scripts to US/Central. The full list of supported time zones is available here and you should simply replace "US/Central" with the desired timezone.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Creating a simple, safe contact form

If you've ever wanted a feedback or contact form on your website, you may find the following code...

Cron jobs

A 'cron job' is an automated task that can be set up within your cPanel. This will typically be...

File permissions

There are a number of file permissions, which can be used for a variety of different purposes,...

How do I create a custom php.ini file?

A custom php.ini file can be constructed and placed in your web account. For instance, using a...