PeepSo_Helpers::get_gmt_value( $gmt_time )


Source

File: src/integrations/peepso/helpers/peepso-helpers.php

	public function get_gmt_value( $gmt_time ) {
		$offset_range = array(
			- 12,
			- 11.5,
			- 11,
			- 10.5,
			- 10,
			- 9.5,
			- 9,
			- 8.5,
			- 8,
			- 7.5,
			- 7,
			- 6.5,
			- 6,
			- 5.5,
			- 5,
			- 4.5,
			- 4,
			- 3.5,
			- 3,
			- 2.5,
			- 2,
			- 1.5,
			- 1,
			- 0.5,
			0,
			0.5,
			1,
			1.5,
			2,
			2.5,
			3,
			3.5,
			4,
			4.5,
			5,
			5.5,
			5.75,
			6,
			6.5,
			7,
			7.5,
			8,
			8.5,
			8.75,
			9,
			9.5,
			10,
			10.5,
			11,
			11.5,
			12,
			12.75,
			13,
			13.75,
			14,
		);
		foreach ( $offset_range as $offset ) {
			$offset_label = (string) $offset;
			if ( 0 <= $offset ) {
				$offset_label = '+' . $offset_label;
			}
			$offset_label = 'UTC' . str_replace(
				array(
					'.25',
					'.5',
					'.75',
				),
				array( ':15', ':30', ':45' ),
				$offset_label
			);
			if ( (string) $gmt_time === (string) $offset ) {
				return $offset_label;
			}
		}
	}