Date Functions

Display functions for use in WordPress templates.

Formatted Date

tribe_event_format_date(string $date, [bool $displayTime = true], [string $dateFormat = ''])

Returns formatted date

Parameters

  • string
    $date
  • bool
    $displayTime: If true shows date and time, if false only shows date
  • string
    $dateFormat: Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)

Returns

  • string

More Info

  • since: 2.0

Examples

  • Display event date like Mon. Jan. 15th, 2012:
    echo tribe_event_format_date( false, 'D. M j, Y' );
  • Display event date like like Mon. Jan. 15th, 2012 6:00pm (include start time):
    echo tribe_event_format_date( true, 'D. M j, Y' );

End Date

tribe_get_end_date([int $postId = null], [bool $displayTime = 'true'], [string $dateFormat = ''])

Returns the event end date

Parameters

  • int
    $postId: (optional)
  • bool
    $displayTime: If true shows date and time, if false only shows date
  • string
    $dateFormat: Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)

Returns

  • string

More Info

  • return: Date
  • todo: support $postId for recurring events.
  • since: 2.0

Examples

  • Display end date like Mon. Jan. 15th, 2012:
    echo tribe_get_end_date( $post->ID, false, 'D. M j, Y' );
  • Display end date like like Mon. Jan. 15th, 2012 6:00pm (include end time):
    echo tribe_get_end_date( $post->ID, true, 'D. M j, Y' );

Start Date

tribe_get_start_date([int $postId = null], [bool $displayTime = true], [string $dateFormat = ''])

Returns the event start date and time

Parameters

  • int
    $postId: (optional)
  • bool
    $displayTime: If true shows date and time, if false only shows date
  • string
    $dateFormat: Allows date and time formatting using standard php syntax (http://php.net/manual/en/function.date.php)

Returns

  • string

More Info

  • return: Date
  • todo: support $postId for recurring events.
  • since: 2.0

Examples

  • Display start date like Mon. Jan. 15th, 2012:
    echo tribe_get_start_date( $post->ID, false, 'D. M j, Y' );
  • Display start date like like Mon. Jan. 15th, 2012 6:00pm (include end time):
    echo tribe_get_start_date( $post->ID, true, 'D. M j, Y' );

Modern Tribe Newsletter

Insight, Discounts & Notices for People Who Kick Ass..