tribe_end_of_day( string $date = null, string $format = 'Y-m-d H:i:s' )
Returns formatted date for the official end of the day according to the Multi-day cutoff time option
Contents
Parameters
- $date
-
(string) (Optional) The date to find the end of the day, defaults to today
Default value: null
- $format
-
(string) (Optional) Allows date and time formating using standard php syntax (<a href="http://php.net/manual/en/function.date.php">http://php.net/manual/en/function.date.php</a>)
Default value: 'Y-m-d H:i:s'
Return
(string)
Source
File: src/functions/template-tags/date.php
function tribe_end_of_day( $date = null, $format = 'Y-m-d H:i:s' ) { $multiday_cutoff = explode( ':', tribe_get_option( 'multiDayCutoff', '00:00' ) ); $hours_to_add = $multiday_cutoff[0]; $minutes_to_add = $multiday_cutoff[1]; if ( is_null( $date ) || empty( $date ) ) { $date = date( $format, strtotime( 'tomorrow +' . $hours_to_add . ' hours ' . $minutes_to_add . ' minutes' ) - 1 ); } else { $date = Tribe__Date_Utils::is_timestamp( $date ) ? $date : strtotime( $date ); $timestamp = strtotime( date( 'Y-m-d', $date ) . ' +1 day ' . $hours_to_add . ' hours ' . $minutes_to_add . ' minutes' ) - 1; $date = date( $format, $timestamp ); } /** * Deprecated filter tribe_event_end_of_day in 4.0 in favor of tribe_end_of_day. Remove in 5.0 */ $date = apply_filters( 'tribe_event_end_of_day', $date ); /** * Filters the end of day date * * @param string $date */ return apply_filters( 'tribe_end_of_day', $date ); }