How to Change Time Zone Settings in PHP?
On most servers the default time zone of PHP is UTC. To change it for all date and time functions, use date_default_timezone_set(), at the beginning of your script.
<?php
date_default_timezone_set("Asia/Kolkata");
echo date_default_timezone_get();
?>
Output:
Tutorials Class - Output Window
Asia/Kolkata
To change it for the whole server, set it in php.ini:
date.timezone = "Asia/Kolkata"
With the DateTime class you can show one moment in different zones.
<?php
$d = new DateTime("2026-06-01 12:00:00", new DateTimeZone("UTC"));
echo $d->format("H:i") . " UTC<br>";
$d->setTimezone(new DateTimeZone("Asia/Kolkata"));
echo $d->format("H:i") . " India";
?>
Output:
Tutorials Class - Output Window
12:00 UTC
17:30 India
The names of all time zones are on php.net, in the list of supported time zones. See also PHP Date and Time.
Learn more about the similar topics:
| Tutorials |
|---|
| PHP Date and Time |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| How to Change Time Zone Settings in PHP? |
| How to Get the Current Year using PHP? |