timezone_name_get
timezone_name_get($object)
Returns the name of the time zone: the name from the database (Europe/Prague), the offset (+02:00) or the abbreviation (CET), depending on how the zone was created. It is the same as $object->getName().
Parameters
- $object – a DateTimeZone object.
Examples
echo timezone_name_get(timezone_open("Europe/Prague")); // Europe/Prague
echo timezone_name_get(timezone_open("+02:00")); // +02:00
echo timezone_name_get(timezone_open("CET")); // CET
// the name stays as it was entered
echo timezone_name_get(timezone_open("europe/prague")); // europe/prague
// the zone of a DateTime object
echo timezone_name_get(date_timezone_get(date_create("2026-10-05", timezone_open("UTC")))); // UTC
// the same with a method
echo timezone_open("Asia/Tokyo")->getName(); // Asia/Tokyo
Things to watch out for
- It does not convert the name to a uniform form. Compare a zone from user input with the list from timezone_identifiers_list(), where the names are in their exact form.
- For a fixed offset it returns the text +02:00, not the name of a place.
- The current abbreviation (CET in winter, CEST in summer) is output by format("T") of a DateTime object.
Related functions:
timezone_open()
date_timezone_get()
timezone_identifiers_list()
date_default_timezone_get()