IntlDateFormatter::getTimeZoneId

(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Get the timezone-id used for the IntlDateFormatter
public string IntlDateFormatter::getTimeZoneId ( void )

Object oriented style

Procedural style

string datefmt_get_timezone_id ( IntlDateFormatter $fmt )

Get the timezone-id used for the IntlDateFormatter.

Parameters:
fmt

The formatter resource.

Returns:

ID string for the time zone used by this formatter.

Examples:
datefmt_get_timezone_id() example
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$fmt = datefmt_create(
    'en_US',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo 'timezone_id of the formatter is : ' . datefmt_get_timezone_id($fmt);
datefmt_set_timezone_id($fmt'CN');
echo 'Now timezone_id of the formatter is : ' . datefmt_get_timezone_id($fmt);
 
?>
OO example
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$fmt new IntlDateFormatter(
    'en_US',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo 'timezone_id of the formatter is : ' $fmt->getTimezoneId();
$fmt->setTimezoneId('CN');
echo 'Now timezone_id of the formatter is : ' $fmt->getTimezoneId();
 
?>
See also:

datefmt_set_timezone_id() -

datefmt_create() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.