The wrong date or time on your site or e-mails: WordPress, PHP and time zones

The short answer: “the time is wrong” can come from four places, and fixing one does not fix the others: WordPress (the time of posts and scheduled publications), PHP (hand-made programs), the server (scheduled tasks and logs) and your device (the clock on the computer or phone). Find out first which it is.

Which is your case

What you see The cause What to do
WordPress posts show the wrong time, or scheduled posts go out at the wrong hour WordPress’s time zone. Under Settings > General, choose a city in your zone (for example, Maputo or Luanda) rather than “UTC+2”. Choosing the city also handles clock changes, if there are any.
A form or custom program shows the wrong time PHP uses the server’s zone, which may not be yours. Set PHP’s zone (the date.timezone option in the panel’s PHP options, or in code). See Viewing and adjusting your PHP configuration.
A cron task runs at a time other than the one you wrote Scheduled tasks follow the server’s clock. Work out the difference to your zone, or see Cron schedule examples.
An e-mail shows the wrong time The time comes from the device that sent it and the time zone of the app reading it. Check the clock and zone of the sending device, and the mail program’s zone setting.
The browser says “your connection is not private” on every site The clock on your device is badly off, and the browser thinks the certificate has expired. Switch on the device’s automatic date and time and reload the page. See No padlock.

Fixing it step by step

1 See how far off it is (an hour? a difference that changed with daylight saving?). The difference tells you where it comes from.
2 Fix WordPress under Settings > General, and save.
3 Fix PHP, if you have custom programs.
4 Confirm on the device itself that automatic date and time are on.
On a VPS, the server has its own zone: How to set the time zone and keep the clock correct on a Linux VPS. On a Windows VPS, it is in Settings > Time & language.

Still the wrong time after fixing everything? Open a ticket with the address and an example (what it shows and what it should show).

Open a support ticket

SEE ALSO

How to set the time zone and keep the clock correct on a Linux VPS

Viewing and adjusting your PHP configuration: version per folder, extensions and phpinfo

Cron schedule examples: every 15 minutes, weekdays at 8, the first of the month

No padlock on your site: the causes, in order

RECOMMENDED PRODUCT

WordPress hosting

One-click install, updates handled, and speed that holds up. from $5.36/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?