PHP | DateTimeZone::getName() Function
Last Updated :
11 Oct, 2019
The DateTimeZone::getName() function is an inbuilt function in PHP which is used to return the name of the created timezone.
Syntax:
DateTimeZone::getName()
Parameters: This function does not accept any parameter.
Return Values:: This function return the name of the created timezone.
Below programs illustrate the DateTimeZone::getName() function:
Program 1:
<?php
$timeZone = "Asia/Kolkata" ;
$DatetimeZone = new DateTimeZone( $timeZone );
print_r( $DatetimeZone ->getName());
?>
|
Output:
Asia/Kolkata
Program 2:
<?php
$DatetimeZone = new DateTimeZone( "Asia/Singapore" );
print_r( $DatetimeZone ->getName());
?>
|
Output:
Asia/Singapore
Reference
https://devdocs.io/php/datetimezone.getname
Share your thoughts in the comments
Please Login to comment...