w3resource

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:

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

Sample Output:

1

View the example in the browser

See also

PHP Function Reference

Previous: date_default_ timezone_get
Next: date_sunrise



Follow us on Facebook and Twitter for latest update.