Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.


Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
MEC_HELPERS::get_date( mixed $type = 'start', mixed $format = 'F j, o g:i A' )

Returns the date of the event.


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$type

(Optional) Either 'start' or 'end'

Default value: 'start'

$format

(Optional) The format of date.

Default value: 'F j, o g:i A'


Top ↑

Return Return

(string) The formatted event date.


Source Source

File: src/integrations/modern-events-calendar/helpers/mec-helpers.php

	private function get_date( $type = 'start', $format = 'F j, o g:i A' ) {
		// Get the date settings.
		$date_settings = unserialize( end( $this->event_meta['mec_date'] ) ); // phpcs:ignore
		// Get the start date.
		$date_start_date = $date_settings[ $type ]['date'];
		// Format the start time.
		$date_start = sprintf(
			'%s %02d:%02d %s',
			$date_start_date,
			$date_settings[ $type ]['hour'],
			$date_settings[ $type ]['minutes'],
			$date_settings[ $type ]['ampm']
		);
		// Create new DateTime object from formatted start time.
		$date_start_obj = new \DateTime( $date_start );
		// Format the date start time using DateTime format method.
		return $date_start_obj->format( $format );
	}