2 IntlDateFormatter, calendars and time zone
4 date.timezone=Atlantic/Azores
7 if (!extension_loaded('intl'))
8 die('skip intl extension not enabled');
11 ini_set("intl.error_level", E_WARNING);
13 $fmt1 = new IntlDateFormatter('en_US',
14 IntlDateFormatter::FULL,
15 IntlDateFormatter::FULL,
17 IntlDateFormatter::TRADITIONAL);
18 $fmt2 = new IntlDateFormatter('en_US',
19 IntlDateFormatter::FULL,
20 IntlDateFormatter::FULL,
22 IntlDateFormatter::GREGORIAN);
23 $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
24 IntlDateFormatter::FULL,
25 IntlDateFormatter::FULL,
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')));
32 new IntlDateFormatter('en_US@calendar=hebrew',
33 IntlDateFormatter::FULL,
34 IntlDateFormatter::FULL,
40 string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
41 string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
42 string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12"
44 Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN in %s on line %d