|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-08-16 16:09 UTC] mathieuk at gmail dot com
[2010-09-01 20:08 UTC] stas@php.net
-Package: Feature/Change Request
+Package: *General Issues
[2010-09-01 20:08 UTC] stas@php.net
[2014-01-11 10:45 UTC] gmblar+php at gmail dot com
[2015-08-18 17:32 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
-Package: *General Issues
+Package: intl
[2015-08-18 17:32 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 17:00:02 2025 UTC |
Description: ------------ Feature request for the new intl extension. Both the MessageFormatter and the IntlDateFormatter accept values for dates. The IntlDateFormatter accepts both Unix timestamps and the value for localtime(). I'm assuming it's the same for the MessageFormatter. Since PHP 5.2 we have the DateTime object through the standard date extension. While it's easy to get the unix timestamp from a DateTime object through DateTime::getTimestamp() introduce in 5.3, this is an extra statement which just adds clutter. Could these two formatters be made to also accept DateTime objects ? Reproduce code: --------------- <?php $date = new DateTime("1 year ago"); $msgfmt = MessageFormatter::create('nl_NL', 'Today one year ago is {0,date}'); echo $msgfmt->format(array($date)); ?> Expected result: ---------------- Output: Today one year ago is 15 aug 2007 Actual result: -------------- Output: Today one year ago is 1 jan 1970