Bug #69150 [NEW]: DateTime object does not update micro seconds

From: Date: Sat, 28 Feb 2015 23:47:47 +0000
Subject: Bug #69150 [NEW]: DateTime object does not update micro seconds
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191011@lists.php.net to get a copy of this message
From:             remyfox at hotmail dot com
Operating system: Windows 7
PHP version:      5.6.6
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime object does not update micro seconds

Description:
------------
Micro seconds on the date property (and consequently, formatted output)
do not update after the initial creation of the DateTime object.

Test script:
---------------
$datetime = Datetime::createFromFormat('Y-m-d H:i:s.u', '2009-02-09
15:16:17.015750');
$datetime->setTimeStamp(0);
print_r($datetime);
	
$datetime = Datetime::createFromFormat('Y-m-d H:i:s', '2009-02-09
15:16:17');
$datetime->setTimeStamp(0.123);
print_r($datetime);

Expected result:
----------------
DateTime Object
(
    [date] => 1970-01-01 01:00:00.000000
    [timezone_type] => 3
    [timezone] => Europe/Berlin
)
DateTime Object
(
    [date] => 1970-01-01 01:00:00.123000
    [timezone_type] => 3
    [timezone] => Europe/Berlin
)

Actual result:
--------------
DateTime Object
(
    [date] => 1970-01-01 01:00:00.015750
    [timezone_type] => 3
    [timezone] => Europe/Berlin
)
DateTime Object
(
    [date] => 1970-01-01 01:00:00.000000
    [timezone_type] => 3
    [timezone] => Europe/Berlin
)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=69150&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69150&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69150&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69150&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69150&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69150&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69150&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69150&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69150&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69150&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69150&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69150&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69150&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69150&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69150&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69150&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69150&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69150&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69150&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69150&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69150&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#191011) next »