Title: WP_Customize_Date_Time_Control::format_gmt_offset
Published: November 20, 2017
Last modified: May 20, 2026

---

# WP_Customize_Date_Time_Control::format_gmt_offset( float $offset ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#wp--skip-link--target)

Format GMT Offset.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#see-also)󠁿

 * [wp_timezone_choice()](https://developer.wordpress.org/reference/functions/wp_timezone_choice/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#parameters)󠁿

 `$offset`floatrequired

Offset in hours.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#return)󠁿

 string Formatted offset.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#source)󠁿

    ```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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/customize/class-wp-customize-date-time-control.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/customize/class-wp-customize-date-time-control.php#L306)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/customize/class-wp-customize-date-time-control.php#L306-L318)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Customize_Date_Time_Control::get_timezone_info()](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/get_timezone_info/)`wp-includes/customize/class-wp-customize-date-time-control.php` |

Get timezone info.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_date_time_control/format_gmt_offset/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_date_time_control%2Fformat_gmt_offset%2F)
before being able to contribute a note or feedback.