Copyright © tutorialspoint.com
|
int date_offset_get ( DateTime $object ) int DateTime::getOffset ( void ) |
These functions return the daylight saving time offset.
The above two functions are equivalent and any of the functions can be used as shown below in the example.
| Parameter | Description |
|---|---|
| object | Required. DateTime object |
Returns DST offset in seconds on success or FALSE on failure.
Following is the usage of this function:
<?php $dateSrc = '2007-04-19 12:50 GMT'; $dateTime = date_create( $dateSrc);; $retval = date_offset_get( $dateTime); echo "Returned value is $retval"; echo "<br />"; # Using second function. $dateTime = new DateTime($dateSrc); $retval = $dateTime->getOffset(); echo "Returned value is $retval"; ?> |
This will produce following result:
Returned value is -21600 Returned value is -21600 |
Copyright © tutorialspoint.com