ID: 45829 Updated by: [EMAIL PROTECTED] Reported By: mathieuk at gmail dot com -Status: Open +Status: Assigned Bug Type: Feature/Change Request Operating System: Mac OSX 10.5 PHP Version: 5.3.0alpha1 -Assigned To: +Assigned To: stas
Previous Comments: ------------------------------------------------------------------------ [2008-08-16 16:09:15] mathieuk at gmail dot com Additionally, MessageFormatter::parse() might return a DateTime object instead of a UNIX timestamp. ------------------------------------------------------------------------ [2008-08-15 06:13:57] mathieuk at gmail dot com 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45829&edit=1