In your WordPress site, there are 3 distinct places that are trying to control the current time and time zone. For best results, all three of these areas should have the same time zone set:

  1. Your WordPress Settings: Set under Settings > General.
  2. Your Web Server
  3. Your Database

This documentation explains how Paid Memberships Pro handles time zones and converting time. You can also use this guide to resolve an ‘off by one day’ type error.

Trusting the WordPress Site’s Time Zone

PMPro bases all time calculations off of what you have set up in the WordPress Settings > General > Time Zone field.

Sometimes, your server can override things, but we try to make sure your site settings control what actual time your site is operating in.

PMPro uses a default timestamp in the database. This is where time calculation errors could occur. For instance, you will see errors in time calculations if your database operates in the GMT time zone while WordPress is set to GMT-8.

  • PMPro uses your WordPress settings as a benchmark.
  • Plugin code cannot control your server or database’s time zone settings. We assume that the server and database all match your WordPress settings.
  • If they do not match, you will notice issues with renewals, expirations (especially daily memberships), and granular reporting.

About ‘Off By One Day’ Errors

In most cases, “off by one day” errors occur when your web server, database server, and/or WordPress install are disagreeing about which timezone to use for calculating dates.

Getting everyone to agree on the time zone varies depending on your setup, specifically if you are on shared hosting and have limited access to your server. In this case you may not be able to configure the time zone for one or more of the services listed below.

To resolve timezone errors, though, you should try to make as many of the suggested updates below as you can.

  • Changing the settings will immediately fix some issues.
  • Even after adjusting the settings, some issues may continue because the timestamps were set up before you fixed the time zone.
  • After correctly setting your time zones, you may need to run queries in your database to update the time/date fields.

Time Zone Settings In WordPress

To change the time zone in WordPress go to Settings > General in the WordPress admin. While you’re here, you can also set the date and time formats. PMPro uses these formats when displaying dates and times.

Timezone Settings in WordPress

Time Zone Settings In CentOS/Linux

To change your timezone in CentOS, locate and modify the timezone file (browse around the /usr/share/zoneinfo directory). Then, run these two commands when logged in as root. (Note: don’t copy the #)

# mv /etc/localtime /etc/localtime.bak
# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Time Zone Settings In Apache/PHP

Typically you need to add or edit a line in your php.ini document. Here is a list of time zones at php.net.

date.timezone = "America/New_York"

Time Zone Settings In MySQL

Log into MySQL as root and run this query: (More information on time zones in MySQL.)

SET time_zone = 'America/New_York';

Was this article helpful?
YesNo