1--TEST--
2IntlDateFormatter::formatObject(): IntlCalendar tests
3--SKIPIF--
4<?php
5if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
6<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >=  0) die('skip for ICU < 50.1.2'); ?>
7--FILE--
8<?php
9ini_set("intl.error_level", E_WARNING);
10ini_set("intl.default_locale", "pt_PT");
11ini_set("date.timezone", "Europe/Lisbon");
12
13$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
14echo IntlDateFormatter::formatObject($cal), "\n";
15echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
16echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
17echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
18echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
19
20$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
21echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
22
23$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
24$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
25echo IntlDateFormatter::formatObject($cal), "\n";
26echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
27
28?>
29==DONE==
30
31--EXPECTF--
3201/01/2012 00:00:00
33Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
34Jan 1, 2012 12:00:00 AM
351/1/12 12:00:00 AM Western European %STime
36Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
37Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
3806/02/1433 00:00:00
39Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
40==DONE==
41
42