Automattic\WooCommerce\Admin\API\Reports
TimeInterval::convert_local_datetime_to_gmt
Converts local datetime to GMT/UTC time.
Method of the class: TimeInterval{}
No Hooks.
Returns
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() TimeInterval::convert local datetime to gmt code WC 10.3.6
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;
}