DateTimeZone::getOffset

PHP 5 >= 5.2.0, PHP 7, PHP 8
DateTimeZone::getOffset - Returns the timezone offset from GMT
Manual
Code Examples

DateTimeZone::getOffset( DateTimeInterface$datetime ): public int

Procedural style

inttimezone_offset_get DateTimeZoneobject DateTimeInterfacedatetime

Parameters

object

Procedural style only: A DateTimeZone object returned by timezone_open

datetime

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

Return Values

Returns time zone offset in seconds.

Changelog

Version Description
8.0.0 Prior to this version, false was returned on failure.

Example of DateTimeZone::getOffset

Show all examples for DateTimeZone::getOffset

PHP Version:


Function DateTimeZone::getOffset:

Date and Time Functions

Most used PHP functions