Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

timezone_offset_get()

Example

Retrieve the timezone offset from GMT.

<?php
$tz=timezone_open(“Asia/Taipei”);
$dateTimeOslo=date_create(“now”,timezone_open(“Europe/Oslo”));
echo timezone_offset_get($tz,$dateTimeOslo);
?>

Definition and Usage

The timezone_offset_get() function returns the timezone offset from GMT.

Syntax

timezone_offset_get(object, datetime)

Parameter Values

 

Parameter

Description

object

Required. Specifies a DateTimeZone object obtained from timezone_open().

datetime

Required. Specifies the date/time for computing the offset.

Technical Details

Return Value:

Returns the timezone offset in seconds on success, or FALSE on failure.

PHP Version:

5.2+