PHP timezone_offset_get() Function
In this chapter you will learn:
- Definition for PHP timezone_offset_get() Function
- Syntax for PHP timezone_offset_get() Function
- Parameter for PHP timezone_offset_get() Function
- Return value for PHP timezone_offset_get() Function
- Example - Return the timezone offset from GMT
Definition
The timezone_offset_get() returns the timezone offset from GMT.
Syntax
PHP timezone_offset_get() Function has the following
timezone_offset_get(object,datetime)
Parameter
Parameter | Is Required | Description |
---|---|---|
object | Required. | DateTimeZone object returned by timezone_open() |
datetime | Required. | date/time to compute the offset from |
Return
PHP timezone_offset_get() Function returns the timezone offset in seconds on success. FALSE on failure.
Example
Return the timezone offset from GMT:
<?php/* j a v a 2s . c o m*/
$tz=timezone_open("Asia/Taipei");
$dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));
echo timezone_offset_get($tz,$dateTimeOslo);
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP timezone_open() Function
- Syntax for PHP timezone_open() Function
- Parameter for PHP timezone_open() Function
- Return value for PHP timezone_open() Function
- Example - Create a new DateTimeZone object, then return the name of the timezone
Home » PHP Tutorial » PHP Date Functions