w3resource

PHP : date_default_ timezone_set() function

PHP: Sets the default timezone used by all date/time functions in a script

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/date_default_timezone_set.php