Example 1 — Reading the Timezone After Setting It
Set a timezone first so the output is predictable, then read it back with date_default_timezone_get().
<?php
date_default_timezone_set('UTC');
echo date_default_timezone_get(), PHP_EOL;
date_default_timezone_set('Asia/Kolkata');
echo date_default_timezone_get(), PHP_EOL;
$ts = strtotime('2024-01-15 10:30:00 UTC');
echo date('Y-m-d H:i T', $ts), PHP_EOL; How It Works
- After setting UTC, date_default_timezone_get() returns the string UTC.
- Setting Asia/Kolkata replaces the default, and the getter shows the new value.
- The timestamp is created from a UTC string, so it always means the same moment.
- date() uses the default timezone, so the moment prints as 16:00 IST.

