PHP date_offset_get() Function

Definition

The date_offset_get() function returns the timezone offset.

Syntax

PHP date_offset_get() Function has the following syntax.

date_offset_get(object);

Parameter

object - Required. DateTime object returned by date_create()

Return

PHP date_offset_get() Function returns the timezone in seconds from UTC on success. FALSE on failure.

Example

Return the timezone offset for Oslo Norway, Europe in seconds from UTC, winter and summer:


<?php//from  ww  w  . j  av  a  2s  .c  om
$winter=date_create("2013-12-31",timezone_open("Europe/Oslo"));
$summer=date_create("2013-06-30",timezone_open("Europe/Oslo"));

echo date_offset_get($winter) . " seconds.\n";
echo date_offset_get($summer) . " seconds.";
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions