diff --git a/reference/intl/dateformatter/settimezone.xml b/reference/intl/dateformatter/settimezone.xml index 0558bd154e..1cd28b869c 100644 --- a/reference/intl/dateformatter/settimezone.xml +++ b/reference/intl/dateformatter/settimezone.xml @@ -5,7 +5,7 @@ IntlDateFormatter::setTimeZone datefmt_set_timezone - Sets formatter's timezone + Sets formatterʼs timezone @@ -28,7 +28,10 @@ mixedzone - &warn.undocumented.func; + + Sets the timezone that will be used when formatting dates or times with this + object. + @@ -39,8 +42,36 @@ zone - + The timezone to use for this formatter. This can be specified in the + following forms: + + + + &null;, in which case the default timezone will be used, as specified in + the ini setting date.timezone. + + + + + An IntlTimeZone, which will be used directly. + + + + + A DateTimeZone. Its identifier will be extracted + and an ICU timezone object will be created; the timezone will be backed + by ICUʼs database, not PHPʼs. + + + + + A string, which should be a valid ICU timezone identifier. + See IntlTimeZone::createTimeZoneIDEnumeration. Raw + offsets such as "GMT+08:30" are also accepted. + + + @@ -49,11 +80,74 @@ &reftitle.returnvalues; - + Returns &true; on success and &false; on failure. + + &reftitle.examples; + + + <function>IntlDateFormatter::setTimeZone</function> examples + +setTimeZone(NULL); +echo "NULL\n\t", $formatter->getTimeZone()->getId(), "\n"; + +$formatter->setTimeZone(IntlTimeZone::createTimeZone('Europe/Lisbon')); +echo "IntlTimeZone\n\t", $formatter->getTimeZone()->getId(), "\n"; + +$formatter->setTimeZone(new DateTimeZone('Europe/Paris')); +echo "DateTimeZone\n\t", $formatter->getTimeZone()->getId(), "\n"; + +$formatter->setTimeZone('Europe/Rome'); +echo "String\n\t", $formatter->getTimeZone()->getId(), "\n"; + +$formatter->setTimeZone('GMT+00:30'); +print_r($formatter->getTimeZone()); + +]]> + + &example.outputs; + + 1 + [id] => GMT+00:30 + [rawOffset] => 1800000 + [currentOffset] => 1800000 +) + +]]> + + + + + + + &reftitle.seealso; + + + IntlDateFormatter::getTimeZone + + + +