Given an ISO 8601 timezone, returns its UTC offset in seconds.
Parameters
$timezone
stringrequired- Either
'Z'
for 0 offset or'±hhmm'
.
Source
/**
* Given an ISO 8601 timezone, returns its UTC offset in seconds.
*
* @since 1.5.0
*
* @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
* @return int|float The offset in seconds.
*/
function iso8601_timezone_to_offset( $timezone ) {
// $timezone is either 'Z' or '[+|-]hhmm'.
if ( 'Z' === $timezone ) {
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.