Tribe__Events__Repositories__Event::use_utc( bool $use_utc )
Instructs the repository to use UTC dates and times for reading operations or not.
Contents
By default the repository will use the events _EventStartDateUTC and _EventEndDateUTC meta keys depending on the site Time Zone Settings. This method allows overriding this behavior on a per-instance basis.
Parameters
- $use_utc
-
(bool) (Required) Whether to use the UTC dates and times to read events or not. If
truethen the_EventStartDateUTCand_EventEndDateUTCmeta keys will be used, iffalsethen the_EventStartDateand_EventEndDatemeta keys will be used.
Return
(static) This repository instance.
Source
File: src/Tribe/Repositories/Event.php
public function use_utc( $use_utc ) {
$this->normal_timezone = $use_utc ?
new DateTimeZone( 'UTC' )
: Timezones::build_timezone_object();
$this->start_meta_key = $use_utc ? '_EventStartDateUTC' : '_EventStartDate';
$this->end_meta_key = $use_utc ? '_EventEndDateUTC' : '_EventEndDate';
return $this;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |