downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DateTime::getTimestamp> <DateTime::getLastErrors
Last updated: Fri, 13 Nov 2009

view this page in

DateTime::getOffset

(PHP 5 >= 5.2.0)

DateTime::getOffset夏時間のオフセットを返す

説明

public int DateTime::getOffset ( void )
int date_offset_get ( DateTime $object )

パラメータ

object

手続き型のみ: date_create() が返す DateTime オブジェクト

返り値

成功した場合に DST オフセット秒数、失敗した場合に FALSE を返します。

例1 夏と冬の間のオフセットの計算

<?php
date_default_timezone_set
('Europe/London');

$winter = new DateTime('2008-12-25 14:25:41');
$summer = new DateTime('2008-07-14 14:25:41');

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



add a note add a note User Contributed Notes
DateTime::getOffset
erik at REMOVE_samson-it dot nl
18-Sep-2009 09:34
"date_default_timezone_set("Europe/Amsterdam")" gives you an offset of 3600 seconds for winter-time and 7200 in summer-time, and not 0 and 3600. don't be tricked by that.

DateTime::getTimestamp> <DateTime::getLastErrors
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites