Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

date_default_timezone_get()

Example

Retrieve the default timezone.

<?php
echo date_default_timezone_get();
?>

Definition and Usage

The date_default_timezone_get() function returns the default timezone used by all date/time functions in the script.

Syntax

date_default_timezone_get()

Technical Details

 

Return Value:

Returns the timezone as a string.

PHP Version:

5.1+

PHP Changelog:

In PHP 5.4, the TZ variable is no longer used to infer the timezone.