PHP date_offset_get() Function
In this chapter you will learn:
- Definition for PHP date_offset_get() Function
- Syntax for PHP date_offset_get() Function
- Parameter for PHP date_offset_get() Function
- Return value from PHP date_offset_get() Function
- Example - Return the timezone offset for Oslo Norway, Europe in seconds from UTC, winter and summer
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// j a va2s . c o m
$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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP date_parse() Function
- Syntax for PHP date_parse() Function
- Parameter for PHP date_parse() Function
- Return value from PHP date_parse() Function
- Example - Parse a string to date
Home » PHP Tutorial » PHP Date Functions