PHP date default timezone set

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : date_default_ timezone_set() function

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 :

  1. echo(date_default_timezone_set('Asia/Calcutta'));  

  2. ?>  

Output :

1