mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
ded3d984c6
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
29 lines
798 B
PHP
29 lines
798 B
PHP
--TEST--
|
|
Test DateTime::getOffset() function : basic functionality
|
|
--FILE--
|
|
<?php
|
|
/* Prototype : public int DateTime::getOffset ( void )
|
|
* Description: Returns the daylight saving time offset
|
|
* Source code: ext/date/php_date.c
|
|
* Alias to functions: date_offset_get
|
|
*/
|
|
|
|
//Set the default time zone
|
|
date_default_timezone_set('Europe/London');
|
|
|
|
echo "*** Testing DateTime::getOffset() : basic functionality ***\n";
|
|
|
|
$winter = new DateTime('2008-12-25 14:25:41');
|
|
$summer = new DateTime('2008-07-02 14:25:41');
|
|
|
|
echo "Winter offset: " . $winter->getOffset() / 3600 . " hours\n";
|
|
echo "Summer offset: " . $summer->getOffset() / 3600 . " hours\n";
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
*** Testing DateTime::getOffset() : basic functionality ***
|
|
Winter offset: 0 hours
|
|
Summer offset: 1 hours
|
|
===DONE===
|