Select Timezone to get current date and time using different formats

Work with named timezones

Use a valid IANA timezone identifier such as Asia/Kolkata or America/New_York. DateTimeImmutable keeps timezone conversion explicit and avoids changing the original object.

$utc = new DateTimeImmutable('now', new DateTimeZone('UTC'));
$india = $utc->setTimezone(new DateTimeZone('Asia/Kolkata'));
echo $india->format('Y-m-d H:i:s T');

This current example appears first; the detailed examples below are retained and modernized for comparison and additional use cases.




Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer