PHP date_default_timezone_set() function

PHP date_default_timezone_get() function
PHP date_diff() function

In this article, you will learn how to set a new timezone. date_default_timezone_set() PHP function set the new default timezone used by all the Date and Time functions in the current script.

What is the syntax of date_default_timezone_set() function in PHP?

date_default_timezone_set(timezone)
ParameterDetails
timezoneTimezone to make it the default – Required
You can refer to the list of all available timezones in PHP at http://www.php.net/manual/en/timezones.php
PHP date_default_timezone_set() method

Examples of the date_default_timezone_set() function

Example 1. In the following example, we simply set the new default timezone to Asia.

<?php
date_default_timezone_set("Asia/Bangkok");
echo date_default_timezone_get();
?

PHP date_default_timezone_get() function
PHP date_diff() function
en English
X
Scroll to Top