WP_Customize_Date_Time_Control::format_gmt_offset( float $offset ): string

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. View all references

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
Version Description
4.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.