Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a4

Bug #14148 Offset for CEST seems to be incorrect
Submitted: 2008-06-16 13:12 UTC
From: pfeigl Assigned:
Status: Open Package: Date (version 1.5.0a1)
PHP Version: 4.3.9 OS: CentOS
Roadmaps: (Not assigned)    
Subscription  


 [2008-06-16 13:12 UTC] pfeigl (Philipp Feigl)
Description: ------------ I've the following date setup on my machine: Mon Jun 16 15:00:05 CEST 2008 CEST is the central european summer time, which is UTC+2, while in winter time we have CET, which it UTC+1. However, when creating a new Date object from a UNIX timestamp (which was of course created in CEST), the resulting time is incorrect by one hour. Setting the same sommertime setup for CEST as it exists for CET in the $GLOBALS['_DATE_TIMEZONE_DATA'] array seems to fixe the issue. Test script: --------------- <?php include 'Date.php'; $ts = time(); $date = new Date($ts); echo $date->format('%d.%m.%Y %H:%M:%S'); echo "\n"; echo date('d.m.Y H:i:s', $ts); ?> Expected result: ---------------- 16.06.2008 15:03:58 16.06.2008 15:03:58 Actual result: -------------- 16.06.2008 14:03:58 16.06.2008 15:03:58

Comments

 [2008-07-21 13:04 UTC] doconnor (Daniel O'Connor)
Test script, php 5.2.6: The Date object doesn't care about the current timezone, it just assumes UTC. Output: 00.00.0000 00:00:00 21.07.2008 13:02:20 <?php date_default_timezone_set('Germany/Berlin'); require_once 'Date.php'; $ts = time(); $date = new Date($ts); echo $date->format('%d.%m.%Y %H:%M:%S'); echo "\n"; echo date('d.m.Y H:i:s', $ts);
 [2008-07-21 13:04 UTC] doconnor (Daniel O'Connor)
(which makes this slightly tricky to test and fix!)