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.

MEC_HELPERS::get_date( mixed $type = 'start', mixed $format = 'F j, o g:i A' )

Returns the date of the event.


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 );

	}