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 #1107

setHour() returns wrong value

Details

Submitted2004-03-31 13:31 UTC
Frommikeatwork at ukonline dot co dot uk
Assignedpajoye
StatusNo Feedback
PackageDate
PHP Version4.3.3
OSRedhat Linux
Roadmaps(Not assigned)

Comments

[2004-03-31 13:31 UTC] mikeatwork at ukonline dot co dot uk

Description:
------------
Setting an instance of Date with a valid timestamp and then querying the getHour() method produces a strange value!

Adding debug output in to the setDate() method shows that the correct value of '13' is being extracted for the hour by the regular expression.

The servers clock is currently set at:
[root@DV1 pear]# date
Wed Mar 31 14:33:25 BST 2004

Suggestions on the #pear IRC channel are that 'BST' is not handled?

Reproduce code:
---------------
<?php
require 'Date.php';

$dateObj = new Date;
$dateObj->setDate("2004-03-31T13:36:07Z", DATE_FORMAT_ISO_EXTENDED);
echo $dateObj->getHour();
?>

Expected result:
----------------
13

Actual result:
--------------
7

[2004-04-08 15:36 UTC] mikeatwork at ukonline dot co dot uk

Bug may be related to the PHP error mentioned at http://bugs.php.net/bug.php?id=23467

[2004-05-16 11:42 UTC] paj at pearfr dot org

Hello,

Cannot be fixed without rewriting most of date_span. The idea to store "huge" timespan using seconds was not good.

I doubt that will get fixed in the 1.x branch.

-- Pierre

[2004-05-16 12:24 UTC] paj at pearfr dot org

Ignore last comment, wrong bug id :)

About this issue, cannot reproduce with latest release.

Please try it again,

--Pierre