w3resource logo


PHP Tutorial

PHP : date_default_ timezone_set() function

Secondary Nav

Description

The date_default_timezone_set() sets the default timezone used by all date/time functions in a script.

Version

(PHP 5 and above)

Syntax

date_default_timezone_set(timezone_identifier)

Parameters

Name Description Required /
Optional
Type
timezone_identifier The timezone identifier. Required String

Return value

FALSE if the timezone_identifier isn't valid, or TRUE otherwise.

Value Type : Boolean.

Example :

<?php
echo(date_default_timezone_set('Asia/Calcutta'));
?>

Output :

1

View the example in the browser

See also

PHP Function Reference



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program