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
[edit] Last updated: Fri, 23 Mar 2012

view this page in

DateTime::getOffset

date_offset_get

(PHP 5 >= 5.2.0)

DateTime::getOffset -- date_offset_getReturns the timezone offset

Opis

Styl obiektowy

public int DateTime::getOffset ( void )

Styl proceduralny

int date_offset_get ( DateTime $object )

Returns the timezone offset.

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

Zwracane wartości

Returns the timezone offset in seconds from UTC on success lub FALSE w przypadku niepowodzenia.

Przykłady

Przykład #1 DateTime::getOffset() example

Styl obiektowy

<?php
$winter 
= new DateTime('2010-12-21', new DateTimeZone('America/New_York'));
$summer = new DateTime('2008-06-21', new DateTimeZone('America/New_York'));

echo 
$winter->getOffset() . "\n";
echo 
$summer->getOffset() . "\n";
?>

Styl proceduralny

<?php
$winter 
date_create('2010-12-21'timezone_open('America/New_York'));
$summer date_create('2008-06-21'timezone_open('America/New_York'));

echo 
date_offset_get($winter) . "\n";
echo 
date_offset_get($summer) . "\n";
?>

Powyższe przykłady wyświetlą:

-18000
-14400

Note: -18000 = -5 hours, -14400 = -4 hours.



add a note add a note User Contributed Notes DateTime::getOffset
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites