From a3d25850f14cc7b83e7cfe45d021f10ea3fb302a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 16 Jun 2013 17:48:31 +0000 Subject: [PATCH] Update documentation on IntlDateFormatter::format() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330521 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/intl/dateformatter/format.xml | 69 +++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/reference/intl/dateformatter/format.xml b/reference/intl/dateformatter/format.xml index 6d4d8f21f5..c56152cda8 100644 --- a/reference/intl/dateformatter/format.xml +++ b/reference/intl/dateformatter/format.xml @@ -44,11 +44,21 @@ value - Value to format. This may be a DateTime object, - an integer representing a Unix timestamp value (seconds - since epoch, UTC) or an array in the format output by + Value to format. This may be a DateTime object, an + IntlCalendar object, a numeric type + representing a (possibly fractional) number of seconds since epoch or an + array in the format output by localtime. + + If a DateTime or an + IntlCalendar object is passed, its timezone is not + considered. The object will be formatted using the formaterʼs configured + timezone. If one wants to use the timezone of the object to be formatted, + IntlDateFormatter::setTimeZone must be called before + with the objectʼs timezone. Alternatively, the static function + IntlDateFormatter::formatObject may be used instead. + @@ -75,6 +85,13 @@ + + 5.5.0/PECL 3.0.0 + + Support for providing IntlCalendar objects to the + value parameter was added. + + 5.3.4 @@ -135,6 +152,51 @@ First Formatted output with pattern is 12/31/1969 Second Formatted output with pattern is 12/31/1969 ]]> + + + With <classname>IntlCalendar</classname> object + +set(IntlCalendar::FIELD_MONTH, 8); //9th month, Ramadan +$cal->set(IntlCalendar::FIELD_DAY_OF_MONTH, 1); //1st day +$cal->clear(IntlCalendar::FIELD_HOUR_OF_DAY); +$cal->clear(IntlCalendar::FIELD_MINUTE); +$cal->clear(IntlCalendar::FIELD_SECOND); +$cal->clear(IntlCalendar::FIELD_MILLISECOND); + +echo "In this islamic year, Ramadan started/will start on:\n\t", + $formatter->format($cal), "\n"; + +//Itʼs the formatterʼs timezone that is used: +$formatter->setTimeZone('Asia/Tokyo'); +echo "After changing timezone:\n\t", + $formatter->format($cal), "\n"; + +]]> + + &example.outputs; + + + + + @@ -145,6 +207,7 @@ Second Formatted output with pattern is 12/31/1969 datefmt_parse datefmt_get_error_code datefmt_get_error_message + datefmt_format_object