Inventory_Presser_Shortcode_Hours_Today::create_date_object_from_hour_string( string $hour_string )

Create a DateTime object from a string like “9:00 AM”

On This Page


Parameters Parameters

$hour_string

(string) (Required) A string like "9:00 AM"


Top ↑

Return Return

(DateTime)


Top ↑

Source Source

File: includes/shortcode/class-shortcode-hours-today.php

	static function create_date_object_from_hour_string( $hour_string ) {
		return DateTime::createFromFormat( 'g:ia', strtolower( str_replace( ' ', '', $hour_string ?? '' ) ) );
	}