timezone_offset_get

Returns the timezone offset from GMT

Syntax

timezone_offset_get ( DateTimeZone $object , DateTimeInterface $datetime ) : int

Parameters

object

A DateTimeZone object returned by timezone_open()

datetime

DateTime that contains the date/time to compute the offset from.

Return

Returns time zone offset in seconds on success or FALSE on failure.

Examples

<?

$object = timezone_open("Asia/Tokyo");
$datetime = date_create("now", $object);

$return = timezone_offset_get($object, $datetime);

echo $return;

?>
32400

PHP

Home Menu