Automattic\WooCommerce\Admin\API\Reports

TimeInterval::convert_local_datetime_to_gmt()public staticWC 1.0

Converts local datetime to GMT/UTC time.

Method of the class: TimeInterval{}

No Hooks.

Return

DateTime.

Usage

$result = TimeInterval::convert_local_datetime_to_gmt( $datetime_string );
$datetime_string(string) (required)
String representation of local datetime.

TimeInterval::convert_local_datetime_to_gmt() code WC 7.3.0

public static function convert_local_datetime_to_gmt( $datetime_string ) {
	$datetime = new \DateTime( $datetime_string, new \DateTimeZone( wc_timezone_string() ) );
	$datetime->setTimezone( new \DateTimeZone( 'GMT' ) );
	return $datetime;
}