Home Tutorial Php Phpdate DateTime::getOffset

 
 

Share on Google+Share on Google+
DateTime::getOffset
Posted on: August 26, 2009 at 12:00 AM
Advertisement
The DateTime::getOffset functions returns the daylight saving time offset. It returns DST offset in seconds on success or False on failure.

DateTime::getOffset  in PHP

This DateTime::getOffset functions returns the daylight saving time offset. It returns DST offset in seconds on success or False on failure. 



Description about Date Time Function PHP

public int DateTime::getOffset ( void )


int date_offset_get ( DateTime $object )



Parameters on Date Time Function in PHP

object - Procedural style only: A DateTime object returned by date_create()



Example: of PHP Date Time Functions

date_default_timezone_set('India/Kolkata');



$winter = new DateTime('2009-01-24 14:25:41');


$summer = new DateTime('2009-06-14 14:25:41');



echo $winter->getOffset(); // Winter offset: 0


echo $summer->getOffset(); // Summer offset: 3600 = 1 hour


?>

Advertisement

Related Tags for DateTime::getOffset :


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com