php messageformatter
MessageFormatter does not work with DateTime instances as parameters in PHP < 5.5. Instance will be converted to timestamp with value 0 (e.g. 1970-01-01) and following Notice will be raised: „Object of class DateTime could not be converted to int“. You have to manually convert the instance to timestamp in these old PHP versions. <?php $datetime = new DateTime(); if (PHP_VERSION_ID < 50500) { // PHP < 5.5 needs conversion to timestamp MessageFormatter::formatMessage('en_US', 'Today is {0, date, full}.', array($datetime->getTimestamp())); } else { // current code MessageFormatter::formatMessage('en_US', 'Today is {0, date, full}.', array($datetime)); } ?>
Source: www.php.net