php-src/ext/date/tests/bug45554.phpt
Remi Collet c2554b4bb4 Fixed Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond
When storing '015700' microseconds in a Datetime object,
Datetime::format('u') returns '015699'

Already known per bug45554 reproducer (also fixed).
2012-12-01 10:20:39 +01:00

21 lines
557 B
PHP

--TEST--
Bug #45554 (Inconsistent behavior of the u format char)
--INI--
date.timezone=UTC
--FILE--
<?php
$format = "m-d-Y H:i:s.u T";
$d = date_create_from_format($format, "03-15-2005 12:22:29.000000 PST");
echo $d->format($format), "\n";
$d = date_create_from_format($format, "03-15-2005 12:22:29.001001 PST");
echo $d->format($format), "\n";
$d = date_create_from_format($format, "03-15-2005 12:22:29.0010 PST");
echo $d->format($format), "\n";
?>
--EXPECT--
03-15-2005 12:22:29.000000 PST
03-15-2005 12:22:29.001001 PST
03-15-2005 12:22:29.001000 PST