In this article, you will learn how to get the name of the timezone. You can either know
about the name of the timezone of your current location or region just by passing the
timezone object to this function or some other timezone object.
What is the syntax of the timezone_name_get() function in PHP?
timezone_name_get(object)
Parameter | Description |
---|---|
object | Datetime Object – Required |
Example of the timezone_name_get() function
Example 1. In this example, we create a new timezone object using the timezone_open object and then the timezone name using the timezone_name_get() function.
<?php
$timezone=timezone_open("Europe/Paris");
echo timezone_name_get($timezone);
?>