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

addSeconds fails to work properly with negative numbers

Details

Submitted2006-11-21 23:16 UTC
Fromkpeters at monolithss dot com
Assignedfirman
StatusClosed
PackageDate
PHP Version4.3.3
OSSuSE Linux 9.0
Roadmaps(Not assigned)

Comments

[2006-11-21 23:16 UTC] kpeters at monolithss dot com

Description:
------------
Adding a negative number of seconds to a date via addSeconds does not modify the date.

Test script:
---------------
<?php
require_once 'Date.php';
$date = new Date('2006-11-21');

print "Date is now: " . $date->format("%Y-%m-%d %H:%M") . "\n";
$date->addSeconds(-1 * 86400 * 7); # subtract 1 week
print "After subtracting a week's worth of seconds, date is: " . $date->format("%Y-%m-%d %H:%M") . "\n";

?>

Expected result:
----------------
Date should be decremented by the specified number of seconds

Actual result:
--------------
Date is unchanged.