msgfmt_format_datetime.phpt 572 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. MessageFormatter::format(): DateTime accepted to format dates and times
  3. --INI--
  4. date.timezone=Atlantic/Azores
  5. --SKIPIF--
  6. <?php
  7. if (!extension_loaded('intl'))
  8. die('skip intl extension not enabled');
  9. --FILE--
  10. <?php
  11. ini_set("intl.error_level", E_WARNING);
  12. //ini_set("intl.default_locale", "nl");
  13. $fmt = <<<EOD
  14. {0,date} {0,time}
  15. EOD;
  16. $dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon"));
  17. $mf = new MessageFormatter('en_US', $fmt);
  18. var_dump($mf->format(array($dt)));
  19. ?>
  20. ==DONE==
  21. --EXPECTF--
  22. string(%s) "May %d, 2012 %d:%d:42 %s"
  23. ==DONE==