Timezone Support
Every event has a timezone. For a site whose events all happen in one place, that is your site's timezone and you never need to think about it. If you list events in other cities or countries, or run online events for people around the world, you can set the timezone event by event and choose which timezone times are displayed in.
Timezones also decide when an event counts as over. An event that finished this morning in Auckland drops out of your upcoming lists at the right moment, whatever the timezone of your site.
Timezone settings
Both settings are in Events then Settings then General then General Options, under Event Settings.
| Setting | What it does |
|---|---|
| Enable Timezone Support? | Yes (the default) shows a Timezone field on every event. With No, the field is hidden and new events get your site's timezone. |
| Default Timezone | The timezone a new event starts with. It begins as your site's timezone, set in Settings then General in WordPress. |
Set an event's timezone
In the When box of the event editor (the When tab in the block editor), choose a city or a UTC offset in Timezone. The start and end times you enter are times in that timezone.
- Classic editor
- Block editor
The times of this event are New York times, whatever the timezone of the site.
The times of this event are New York times, whatever the timezone of the site.
Choose a city where you can. A city follows its local daylight saving changes. A fixed offset such as UTC-5 does not.
On a recurring event, each recurrence pattern has its own Timezone among its options.
In Events then Events, an event whose timezone differs from your site's has an information icon next to its time. Hover over it to see the timezone.
If you later turn timezone support off, events that already have a different timezone keep it, and the Timezone field stays visible on those events.
Which timezone visitors see
By default, dates and times are shown in the event's own timezone: a 7pm concert in New York reads 7pm to everyone. That suits events people attend in person.
For online events, you may prefer to show each visitor the time where they are. You choose by picking the placeholder you put in your formats.
| Show times in | Dates | Times |
|---|---|---|
| The event's timezone | #_EVENTDATES | #_EVENTTIMES, #_12HSTARTTIME, #_24HSTARTTIME and the other standard time placeholders |
| The visitor's timezone | #_EVENTDATES_LOCAL | #_EVENTTIMES_LOCAL, #_12HSTARTTIME_LOCAL, #_12HENDTIME_LOCAL, #_12HTIMES_LOCAL, #_24HSTARTTIME_LOCAL, #_24HENDTIME_LOCAL, #_24HTIMES_LOCAL |
| Your site's timezone | #_EVENTDATES_SITE | #_EVENTTIMES_SITE, #_12HSTARTTIME_SITE, #_12HENDTIME_SITE, #_24HSTARTTIME_SITE, #_24HENDTIME_SITE |
The visitor's timezone is read from their browser, so the _LOCAL placeholders need JavaScript and are filled in after the page loads.
To print the name of a timezone:
| Placeholder | Shows |
|---|---|
#_EVENTTIMEZONE | The event's timezone in readable form, such as America/New York. |
#_EVENTTIMEZONERAW | The same as stored, such as America/New_York. |
#_EVENTTIMEZONE_LOCAL | The visitor's own timezone. Use it beside the _LOCAL times so people know which timezone they are reading. |
A common pattern for an online event shows both:
<p>#_EVENTDATES, #_EVENTTIMES (#_EVENTTIMEZONE)</p>
<p>Your time: #_EVENTDATES_LOCAL, #_EVENTTIMES_LOCAL (#_EVENTTIMEZONE_LOCAL)</p>
Calendars and lists
| Attribute | Use it on | What it does |
|---|---|---|
calendar_timezone | [events_calendar] | Places events on the calendar by their date and time in the timezone you name, for example calendar_timezone="Europe/London", in place of each event's local date. |
timezone_scope | Any event list or calendar | Works out date ranges such as today or month in one timezone. Give a timezone name, or 1 for your site's timezone. |
Without these, a filter such as "today" compares against each event's own local date.
Booking forms
When a visitor picks a date or a time on the booking form of a recurring event or an event with timeslots, a Timezone selector above the list lets them view the times in another timezone.
Calendar feeds
iCal feeds and the add-to-calendar links include each event's timezone, so the event lands at the right time in the visitor's calendar app.
Reset the timezone of every event
If your events were created with the wrong timezone, for example because the site's own timezone was never set, you can change them all at once.
-
Back up your database.
-
Go to Events then Settings then General then Admin Tools (Advanced) and find Reset Timezones.
-
Choose the timezone in the dropdown.
-
Click Reset Event Timezones and confirm.
The reset changes the timezone of all events, including any you deliberately gave a different timezone, and it can't be undone. The times stay as entered: an event at 7pm is still at 7pm, now in the new timezone.
On a multisite network the tool is in the network admin's Events Manager settings, where you also choose which site to reset.
Developer notes
Dates and times are handled by EM_DateTime and EM_DateTimeZone, which extend PHP's DateTime and DateTimeZone and are documented inline in classes/em-datetime.php and classes/em-datetimezone.php. Read dates through these objects instead of the raw properties.
$EM_Event->start()->getDate(); // start date, Y-m-d, in the event's timezone
$EM_Event->end()->i18n( 'j F Y, g:i a' ); // translated, formatted end date and time
$EM_Event->start( true )->getDateTime(); // start as a UTC date and time
$EM_Event->start()->getTimestamp() > time(); // true if the event has not started yet
$EM_Event->get_timezone()->getName(); // the event's timezone name
$EM_Event->set_timezone( 'America/New_York' );
Timestamps returned by these objects are real UTC timestamps, so compare them with time() and not with current_time( 'timestamp' ).
In the database, event_start and event_end in the events table hold the UTC start and end, and event_timezone holds the timezone name or UTC offset. The same values are stored as post meta (_event_start, _event_end, _event_timezone), along with _event_start_local and _event_end_local for sorting by local time.
Tickets and bookings follow the same pattern. $EM_Ticket->start() and $EM_Ticket->end() return the sale dates in the event's timezone, and $EM_Booking->date() returns when the booking was made:
echo $EM_Booking->date()->setTimezone( 'Europe/London' )->format( 'd/m/Y H:i' );
Troubleshooting
There is no Timezone field on my events
Enable Timezone Support? is set to No.
An event shows at the wrong time
Open the event and check its Timezone. Events created before you set your site's timezone may carry the old one. To fix many at once, use Reset Timezones.
The visitor's local time shows "JavaScript Disabled"
The _LOCAL placeholders are filled in by JavaScript in the visitor's browser. That text shows where scripts can't run, such as in an email. Use the standard placeholders there.