Bug #74298 [NEW]: IntlDateFormatter->format() doesn't return microseconds/fractions
| From: | jh at ht-studios dot de | Date: | Thu, 23 Mar 2017 14:22:02 +0000 |
| Subject: | Bug #74298 [NEW]: IntlDateFormatter->format() doesn't return microseconds/fractions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-208025@lists.php.net to get a copy of this message | ||
From: jh at ht-studios dot de
Operating system: Ubuntu 16.04 (puphpet)
PHP version: 7.1.3
Package: *General Issues
Bug Type: Bug
Bug description:IntlDateFormatter->format() doesn't return microseconds/fractions
Description:
------------
PHP's IntlDateFormatter/IntlDateFormatter->format() returns zeros
instead of Fractional Seconds:
http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details
$ aptitude search '~i icu'
i A libicu52 - International Components for Unicode
Test script:
---------------
<?php
echo "All 3 should show the fractions of second:\n";
echo var_dump((new \DateTime())->format('Y-m-d\TH:i:s.u'));
echo var_dump((new \IntlDateFormatter(
'en-US',
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'UTC',
\IntlDateFormatter::GREGORIAN,
'yyyy-MM-dd HH:mm:ss.SSSSSS'
))->format(new \DateTime()));
echo var_dump(datefmt_create(
'en-US',
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'UTC',
\IntlDateFormatter::GREGORIAN,
'yyyy-MM-dd HH:mm:ss.SSSSSS'
)->format(new \DateTime()));
Expected result:
----------------
Microseconds should be outputted correctly.
Actual result:
--------------
Instead you get '000000`'
See: https://3v4l.org/3pMtR
--
Edit bug report at https://bugs.php.net/bug.php?id=74298&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74298&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74298&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74298&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74298&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74298&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74298&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74298&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74298&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74298&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74298&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74298&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74298&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74298&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74298&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74298&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74298&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74298&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74298&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74298&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74298&r=mysqlcfg