Tribe__Events__Repositories__Event::filter_by_on_date( int|string|DateTime $date, null $timezone = null )
Filters events to include only those that start on a specific date.
Contents
This method is a wrapper for the filter_by_starts_between
one.
Parameters
- $date
-
(int|string|DateTime) (Required) A date and time timestamp, string or object.
- $timezone
-
(null) (Optional) The timezone that should be used to filter events, if not passed the site one will be used. This parameter will be ignored if the
$date
parameter is an object.Default value: null
Source
File: src/Tribe/Repositories/Event.php
public function filter_by_on_date( $date, $timezone = null ) { $timezone = Tribe__Timezones::build_timezone_object( $timezone ); $date = Tribe__Date_Utils::build_date_object( $date, $timezone ); $begin = new DateTime( tribe_beginning_of_day( $date->format( Tribe__Date_Utils::DBDATETIMEFORMAT ) ), $timezone ); $end = new DateTime( tribe_end_of_day( $date->format( Tribe__Date_Utils::DBDATETIMEFORMAT ) ), $timezone ); // Add on second to the previous day to get the start of this day. $this->filter_by_starts_between( $begin, $end ); }
Changelog
Version | Description |
---|---|
4.9 | Introduced. |