WP_Customize_Date_Time_Control::format_gmt_offset() WordPress Method

The format_gmt_offset() method is used to format the GMT offset for the date/time control. The method accepts two parameters: $offset and $override_gmt. If the $override_gmt parameter is set to true, the GMT offset will be overridden.

WP_Customize_Date_Time_Control::format_gmt_offset( float $offset ) #

Format GMT Offset.


Description

Top ↑

See also


Top ↑

Parameters

$offset

(float)(Required)Offset in hours.


Top ↑

Return

(string) Formatted offset.


Top ↑

Source

File: wp-includes/customize/class-wp-customize-date-time-control.php

	public function format_gmt_offset( $offset ) {
		if ( 0 <= $offset ) {
			$formatted_offset = '+' . (string) $offset;
		} else {
			$formatted_offset = (string) $offset;
		}
		$formatted_offset = str_replace(
			array( '.25', '.5', '.75' ),
			array( ':15', ':30', ':45' ),
			$formatted_offset
		);
		return $formatted_offset;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.