WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

as_get_datetime_object() WC 1.0

Helper function to create an instance of DateTime based on a given string and timezone. By default, will return the current date/time in the UTC timezone.

Needed because new DateTime() called without an explicit timezone will create a date/time in PHP's timezone, but we need to have assurance that a date/time uses the right timezone (which we almost always want to be UTC), which means we need to always include the timezone when instantiating datetimes rather than leaving it up to the PHP default.

Хуков нет.

Возвращает

ActionScheduler_DateTime.

Использование

as_get_datetime_object( $date_string, $timezone );
$date_string(смешанный)
A date/time string. Valid formats are explained in http://php.net/manual/en/datetime.formats.php.
По умолчанию: null
$timezone(строка)
A timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available http://php.net/manual/en/timezones.php.
По умолчанию: 'UTC'

Код as get datetime object: woocommerce/packages/action-scheduler/functions.php WC 4.3.1

<?php
function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) {
	if ( is_object( $date_string ) && $date_string instanceof DateTime ) {
		$date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) );
	} elseif ( is_numeric( $date_string ) ) {
		$date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) );
	} else {
		$date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) );
	}
	return $date;
}