#42842 [NEW]: dst information lost over Year 2038

From: Date: Wed, 03 Oct 2007 16:01:15 +0000
Subject: #42842 [NEW]: dst information lost over Year 2038
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118150@lists.php.net to get a copy of this message
From:             giewont at gmail dot com
Operating system: Windows NT 5.1 build 2600
PHP version:      5.2.4
PHP Bug Type:     Date/time related
Bug description:  dst information lost over Year 2038

Description:
------------
When I create DateTime object using UTC and then switch to timezone with
DST eg. 'Europe/Warsaw' and i set Year to any after 2038 the DST doesn't
work.

like below: in may Warsaw is in GMT+2 time zone so when i set UTC time to
12:00:00 time in Warsaw should be 02:00:00 (14:00:00)


Reproduce code:
---------------
	date_default_timezone_set('Europe/Warsaw');
	$gmt = timezone_open('UTC');
	$eu = timezone_open('Europe/Warsaw');
	
	$date = new DateTime('2040-05-05 12:00:00', $gmt);
	echo $date->format('d-m-Y h:i:s') . '(' .
$date->getTimezone()->getName()
. ')<br>';
	$date->setTimezone($eu);
	echo $date->format('d-m-Y h:i:s') . '(' .
$date->getTimezone()->getName()
. ')<br>';
	$date->setTimezone($gmt);
	
	$date = new DateTime('2000-05-05 12:00:00', $gmt);
	echo $date->format('d-m-Y h:i:s') . '(' .
$date->getTimezone()->getName()
. ')<br>';
	$date->setTimezone($eu);
	echo $date->format('d-m-Y h:i:s') . '(' .
$date->getTimezone()->getName()
. ')<br>';
	$date->setTimezone($gmt);

Expected result:
----------------
05-05-2040 12:00:00(UTC)
05-05-2040 02:00:00(Europe/Warsaw)
05-05-2000 12:00:00(UTC)
05-05-2000 02:00:00(Europe/Warsaw)

Actual result:
--------------
05-05-2040 12:00:00(UTC)
05-05-2040 01:00:00(Europe/Warsaw)
05-05-2000 12:00:00(UTC)
05-05-2000 02:00:00(Europe/Warsaw)

-- 
Edit bug report at http://bugs.php.net/?id=42842&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42842&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42842&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42842&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42842&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=42842&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42842&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42842&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42842&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42842&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42842&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=42842&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=42842&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42842&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42842&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42842&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42842&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42842&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42842&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42842&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42842&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#118150) next »