Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

intldateformatter.gettimezone(3) [php man page]

INTLDATEFORMATTER.GETTIMEZONE(3)					 1					  INTLDATEFORMATTER.GETTIMEZONE(3)

IntlDateFormatter::getTimeZone - Get formatters timezone

	Object oriented style

SYNOPSIS
public IntlTimeZone IntlDateFormatter::getTimeZone (void ) DESCRIPTION
Procedural style IntlTimeZone datefmt_get_timezone (void ) Returns an IntlTimeZone object representing the timezone that will be used by this object to format dates and times. When formatting Intl- Calendar and DateTime objects with this IntlDateFormatter, the timezone used will be the one returned by this method, not the one associ- ated with the objects being formatted. PARAMETERS
This function has no parameters. RETURN VALUES
The associated IntlTimeZone object or FALSE on failure. EXAMPLES
Example #1 IntlDateFormatter.getTimeZone(3) examples <?php $madrid = IntlDateFormatter::create(NULL, NULL, NULL, 'Europe/Madrid'); $lisbon = IntlDateFormatter::create(NULL, NULL, NULL, 'Europe/Lisbon'); var_dump($madrid->getTimezone()); echo $madrid->getTimezone()->getDisplayName( false, IntlTimeZone::DISPLAY_GENERIC_LOCATION, "en_US"), " "; echo $lisbon->getTimeZone()->getId(), " "; //The id can also be retrieved with ->getTimezoneId() echo $lisbon->getTimeZoneId(), " "; The above example will output: object(IntlTimeZone)#4(4) { ["valid"]=> bool(true) ["id"]=> string(13) "Europe/Madrid" ["rawOffset"]=> int(3600000) ["currentOffset"]=> int(7200000) } Spain Time Europe/Lisbon Europe/Lisbon SEE ALSO
IntlDateFormatter.getTimeZoneId(3), IntlDateFormatter.setTimeZone(3), IntlTimeZone. PHP Documentation Group INTLDATEFORMATTER.GETTIMEZONE(3)

Check Out this Related Man Page

INTLDATEFORMATTER.SETTIMEZONE(3)					 1					  INTLDATEFORMATTER.SETTIMEZONE(3)

IntlDateFormatter::setTimeZone - Sets formatters timezone

	Object oriented style

SYNOPSIS
public boolean IntlDateFormatter::setTimeZone (mixed $zone) DESCRIPTION
Procedural style boolean datefmt_set_timezone (mixed $zone) Sets the timezone that will be used when formatting dates or times with this object. PARAMETERS
o $zone - The timezone to use for this formatter. This can be specified in the following forms: o NULL, in which case the default timezone will be used, as specified in the ini setting date.timezone or through the func- tion date_default_timezone_set(3) and as returned by date_default_timezone_get(3). o An IntlTimeZone, which will be used directly. o A DateTimeZone. Its identifier will be extracted and an ICU timezone object will be created; the timezone will be backed by ICUs database, not PHPs. o A string, which should be a valid ICU timezone identifier. See IntlTimeZone.createTimeZoneIDEnumeration(3). Raw offsets such as "GMT+08:30" are also accepted. RETURN VALUES
Returns TRUE on success and FALSE on failure. EXAMPLES
Example #1 IntlDateFormatter.setTimeZone(3) examples <?php ini_set('date.timezone', 'Europe/Amsterdam'); $formatter = IntlDateFormatter::create(NULL, NULL, NULL, "UTC"); $formatter->setTimeZone(NULL); echo "NULL ", $formatter->getTimeZone()->getId(), " "; $formatter->setTimeZone(IntlTimeZone::createTimeZone('Europe/Lisbon')); echo "IntlTimeZone ", $formatter->getTimeZone()->getId(), " "; $formatter->setTimeZone(new DateTimeZone('Europe/Paris')); echo "DateTimeZone ", $formatter->getTimeZone()->getId(), " "; $formatter->setTimeZone('Europe/Rome'); echo "String ", $formatter->getTimeZone()->getId(), " "; $formatter->setTimeZone('GMT+00:30'); print_r($formatter->getTimeZone()); The above example will output: NULL Europe/Amsterdam IntlTimeZone Europe/Lisbon DateTimeZone Europe/Paris String Europe/Rome IntlTimeZone Object ( [valid] => 1 [id] => GMT+00:30 [rawOffset] => 1800000 [currentOffset] => 1800000 ) SEE ALSO
IntlDateFormatter.getTimeZone(3). PHP Documentation Group INTLDATEFORMATTER.SETTIMEZONE(3)
Man Page