Automattic\WooCommerce\Internal\Admin\Reports
HposLegacyOrderReportQueryBuilder::local_timestamp_to_gmt
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.
Метод класса: HposLegacyOrderReportQueryBuilder{}
Хуков нет.
Возвращает
string. GMT datetime in Y-m-d H:i:s format.
Использование
// private - только в коде основоного (родительского) класса $result = $this->local_timestamp_to_gmt( $local_ts ): string;
- $local_ts(int) (обязательный)
- Local timestamp to convert.
Код HposLegacyOrderReportQueryBuilder::local_timestamp_to_gmt() HposLegacyOrderReportQueryBuilder::local timestamp to gmt WC 11.2.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 ) );
}