PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Date and Time » Date » Bug #7689

Incorrect conversion of timezone offsets to unix timestamps

Details

Submitted2006-05-22 09:52 UTC
Frommatt at zgroupplc dot com
StatusNo Feedback
PackageDate
PHP Version5.0.5
OSOS X 10.4.6
Roadmaps(Not assigned)

Comments

[2006-05-22 09:52 UTC] matt at zgroupplc dot com

Description:
------------
When passing '1970-01-01T00:00:00.000+01:00' to the Date class constructor, it interprets the unix timestamp as -7200. This should be -3600. The built in php function strtotime correctly returns -3600.

Test script:
---------------
require_once 'Date.php';

$date = '1970-01-01T00:00:00.000+01:00';
var_dump(strtotime($date));

$date = new Date($date);
var_dump($date->getTime());

Expected result:
----------------
int(-3600)
int(-3600)

Actual result:
--------------
int(-3600)
int(-7200)