PHP | DateTimeZone::getName() Function Last Updated : 11 Oct, 2019 Comments Improve Suggest changes Like Article Like Report 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 <?php // PHP program to illustrate DateTimeZone::getName() // function // Initialising a timezone $timeZone = "Asia/Kolkata"; // Creating DateTimeZone() object with // the above timezone $DatetimeZone = new DateTimeZone($timeZone); // Getting the name of timezone print_r($DatetimeZone->getName()); ?> Output: Asia/Kolkata Program 2: php <?php // PHP program to illustrate DateTimeZone::getName() // function // Creating DateTimeZone() object with // a specific timezone $DatetimeZone = new DateTimeZone("Asia/Singapore"); // Getting the name of timezone print_r($DatetimeZone->getName()); ?> Output: Asia/Singapore Reference https://devdocs.io/php/datetimezone.getname Comment More infoAdvertise with us Next Article PHP | DateTimeZone::getName() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-date-time PHP-function Similar Reads PHP | DatePeriod getEndDate() Function The DatePeriod::getEndDate() function is an inbuilt function in PHP which is used to return the end date. If the given date period does not have any end date then it returns NULL.Syntax: DateTimeInterface DatePeriod::getEndDate( void ) Parameters: This function does not accept any parameters. Return 1 min read PHP | DateTime modify() Function The DateTime::modify() function is an inbuilt function in PHP which is used to modify or can alter the timestamp of a DateTime object. Syntax: Object oriented style: DateTime DateTime::modify( string $modify ) Procedural style: DateTime date_modify( DateTime $object, string $modify ) Parameters: Thi 2 min read PHP | date_get_last_errors() Function The date_get_last_errors() function is an inbuilt function in PHP which is used to returns the warnings and errors. This function parse a date/time string and returns an array of warnings and errors. Syntax: Procedural style: array date_get_last_errors( void ) Object oriented style: array DateTime:: 1 min read PHP | date_offset_get() Function The date_offset_get() function is an inbuilt function in PHP which is used to returns the timezone offset. This function returns the timezone offset in seconds from UTC (Universal Time Coordinated) on success or FALSE on failure. Syntax: Procedural Style: int date_offset_get( $object ) Object Orient 1 min read PHP | DateTime format() Function The DateTime::format() function is an inbuilt function in PHP which is used to return the new formatted date according to the specified format. Syntax: Object oriented style string DateTime::format( string $format ) or string DateTimeImmutable::format( string $format ) or string DateTimeInterface::f 1 min read PHP | DatePeriod getStartDate() Function The DatePeriod::getStartDate() function is an inbuilt function in PHP which is used to return the start date of the given date period. Syntax: DateTimeInterface DatePeriod::getStartDate( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the start da 1 min read PHP | DateTime add() Function The DateTime::add() function is an inbuilt function in PHP which is used to add an amount of time (days, months, years, hours, minutes and seconds) to the given DateTime object. Syntax: Object oriented style: DateTime DateTime::add( DateInterval $interval ) Procedural style: DateTime date_add( DateT 2 min read PHP | DateTime sub() Function The DateTime::sub() function is an inbuilt function in PHP which is used to subtract a number of days, months, years, hours, minutes and seconds from a created DateTime object. Syntax: Object oriented style: DateTime DateTime::sub( DateInterval interval ) Procedural style: DateTime date_sub( DateTim 2 min read PHP | DateTime setDate() Function The DateTime::setDate() function is an inbuilt function in PHP which is used to reset the current date of DateTime object with the given date-time object. Syntax: Object oriented style: DateTime DateTime::setDate( int $year, int $month, int $day ) Procedural style: DateTime date_date_set( DateTime $ 2 min read PHP | date_parse() Function The date_parse() is an inbuilt function in PHP which is used to find the detailed information about a specified date. This function returns an associative array of detailed information for a specified date on success and returns FALSE on failure Syntax: date_parse($date) Parameters Used: The date_pa 2 min read Like