PHP timezone_offset_get() Function

PHP timezone_open() Function
PHP timezone_name_get() Function

In this article, you will learn how to get the timezone offset. The timezone_offset_get()
the method in PHP returns the offset of the timezone from the GMT.

What is the syntax of the timezone_offset_get() function in PHP?

timezone_offset_get(object, datetime)
objectThe DateTime object is returned by the timezone_open method. – Required
datetimeDate/time to allow the function to get offset from it – Required
PHP timezone_offset_get() method

Example of the timezone_offset_get() function

Example 1. In this example, we create a new timezone object using the timezone_open() method and a date/time object. We pass both of these objects to the timezone_offset_get() function to calculate the offset.

echo timezone_offset_get($timezone,$oslo);
PHP timezone_open() Function
PHP timezone_name_get() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z