PHP | date_offset_get() Function Last Updated : 14 Sep, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The date_offset_get() function is an inbuilt function in PHP which is used to returns the timezone offset. This function returns the timezone offset in seconds from UTC (Universal Time Coordinated) on success or FALSE on failure. Syntax: Procedural Style: int date_offset_get( $object ) Object Oriented Style: int DateTime::getOffset( void ) int DateTimeImmutable::getOffset( void ) int DateTimeInterface::getOffset( void ) Parameters: This function accepts single parameter $object which is mandatory in procedural style. The DateTime object returned by date_create() function. But in case of object oriented style no parameter required. Return Value: This function returns the timezone offset in seconds from UTC(Universal Time Coordinated) on success or FALSE on failure. Below programs illustrate the date_offset_get() function in PHP: Program 1: php <?php $date1 = date_create('2018-09-12', timezone_open('Asia/Kolkata')); $date2 = date_create('20018-09-18', timezone_open('Asia/Singapore')); echo date_offset_get($date1) . "\n"; echo date_offset_get($date2) . "\n"; ?> Output: 19800 28800 Program 2: php <?php $date1 = new DateTime('2018-09-12', new DateTimeZone('Asia/Kolkata')); $date2 = new DateTimeImmutable('2018-09-18', new DateTimeZone('Asia/Singapore')); echo $date1->getOffset() . "\n"; echo $date2->getOffset() . "\n"; ?> Output: 19800 28800 Related Articles: PHP | date_date_set() Function PHP | date_parse_from_format() Function PHP | microtime() Function Reference: http://php.net/manual/en/datetime.getoffset.php Comment More infoAdvertise with us Next Article PHP | date_get_last_errors() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | date_get_last_errors() Function The date_get_last_errors() function is an inbuilt function in PHP which is used to returns the warnings and errors. This function parse a date/time string and returns an array of warnings and errors. Syntax: Procedural style: array date_get_last_errors( void ) Object oriented style: array DateTime:: 1 min read PHP | date_parse() Function The date_parse() is an inbuilt function in PHP which is used to find the detailed information about a specified date. This function returns an associative array of detailed information for a specified date on success and returns FALSE on failure Syntax: date_parse($date) Parameters Used: The date_pa 2 min read PHP | timezone_offset_get() Function The timezone_offset_get() function is an inbuilt function in PHP which is used to return the timezone offset from GMT. The date time object and the date-time are sent as a parameter to the timezone_offset_get() function and return the timezone offset in seconds on success or False on failure. Syntax 2 min read PHP | date_modify() Function The date_modify() function is an inbuilt function in PHP. Through the help of this function, we can modify or can alter the timestamp of DateTime object. The DateTime object and string modify are parameters in the calling function. Syntax: date_modify(DateTime $object, string $modify); Parameters: T 2 min read PHP | DatePeriod getEndDate() Function The DatePeriod::getEndDate() function is an inbuilt function in PHP which is used to return the end date. If the given date period does not have any end date then it returns NULL.Syntax: DateTimeInterface DatePeriod::getEndDate( void ) Parameters: This function does not accept any parameters. Return 1 min read PHP | DatePeriod getStartDate() Function The DatePeriod::getStartDate() function is an inbuilt function in PHP which is used to return the start date of the given date period. Syntax: DateTimeInterface DatePeriod::getStartDate( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the start da 1 min read Like