Tribe__Events__Templates::event_date_to_pubDate( $time, $d, $gmt )
Convert the post_date_gmt to the event date for feeds
Contents
Parameters
- $time
-
(Required) the post_date
- $d
-
(Required) the date format to return
- $gmt
-
(Required) whether this is a gmt time
Return
(int|string)
Source
File: src/Tribe/Templates.php
public static function event_date_to_pubDate( $time, $d, $gmt ) {
global $post;
if ( is_object( $post ) && $post->post_type == Tribe__Events__Main::POSTTYPE && is_feed() && $gmt ) {
//WordPress always outputs a pubDate set to 00:00 (UTC) so account for that when returning the Event Start Date and Time
$zone = get_option( 'timezone_string', false );
if ( $zone ) {
$zone = new DateTimeZone( $zone );
} else {
$zone = new DateTimeZone( 'UTC' );
}
$time = new DateTime( tribe_get_start_date( $post->ID, false, $d ), $zone );
$time->setTimezone( new DateTimeZone( 'UTC' ) );
$time = $time->format( $d );
}
return $time;
}