Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::local_timestamp_to_gmt │ private │ WC 1.0

Convert a WordPress "local" timestamp (one that reads as site-local wall-clock time when formatted with {@see gmdate()}) into the equivalent GMT datetime string.

Uses the site timezone via wp_timezone() so the offset is resolved for that specific date. On timezones that observe DST this yields the correct UTC instant for the boundary even when the report range spans a different offset period than "now", unlike a single cached gmt_offset.

Method of the class: HposLegacyOrderReportQueryBuilder{}

No Hooks.

Returns

string. GMT datetime in Y-m-d H:i:s format.

Usage

// private - for code of main (parent) class only
$result = $this->local_timestamp_to_gmt( $local_ts ): string;
$local_ts(int) (required)
Local timestamp to convert.

HposLegacyOrderReportQueryBuilder::local_timestamp_to_gmt() code WC 11.1.2

private function local_timestamp_to_gmt( int $local_ts ): string {
	return (string) $this->local_datetime_to_gmt( gmdate( 'Y-m-d H:i:s', $local_ts ) );
}