Guides › HTML / PHP sites › Site down or error screens

PHP Shows the Wrong Date or Time: Set the Time Zone Correctly

Dates are hours off. Set the time zone in php.ini or in code and store times in UTC.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.

Set it

In code, near the start of your script:

date_default_timezone_set('Asia/Kolkata');

Or set date.timezone in your PHP settings. See our php.ini guide.

Good practice

WordPress

Use its time zone setting. See our WordPress time zone guide.

Server time

If the server clock itself is wrong, ask your host.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-21.