dateformat_calendars_variant2.phpt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. IntlDateFormatter, calendars and time zone
  3. --INI--
  4. date.timezone=Atlantic/Azores
  5. --SKIPIF--
  6. <?php
  7. if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
  8. <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
  9. <?php if (version_compare(INTL_ICU_VERSION, '54.1') >= 0) die('skip for ICU < 54.1'); ?>
  10. --FILE--
  11. <?php
  12. ini_set("intl.error_level", E_WARNING);
  13. $fmt1 = new IntlDateFormatter('en_US',
  14. IntlDateFormatter::FULL,
  15. IntlDateFormatter::FULL,
  16. 'GMT+05:12',
  17. IntlDateFormatter::TRADITIONAL);
  18. $fmt2 = new IntlDateFormatter('en_US',
  19. IntlDateFormatter::FULL,
  20. IntlDateFormatter::FULL,
  21. 'GMT+05:12',
  22. IntlDateFormatter::GREGORIAN);
  23. $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
  24. IntlDateFormatter::FULL,
  25. IntlDateFormatter::FULL,
  26. 'GMT+05:12',
  27. IntlDateFormatter::TRADITIONAL);
  28. var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
  29. var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
  30. var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
  31. new IntlDateFormatter('en_US@calendar=hebrew',
  32. IntlDateFormatter::FULL,
  33. IntlDateFormatter::FULL,
  34. 'GMT+05:12',
  35. -1);
  36. ?>
  37. ==DONE==
  38. --EXPECTF--
  39. string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
  40. string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
  41. string(48) "Sunday, Tevet 6, 5772 AM at 5:12:00 AM GMT+05:12"
  42. Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php on line %d
  43. ==DONE==