Display Indian current time in PHP

This small snippet explains how to get Indian Time in PHP without changing the server times and timezones. So irrespective of whether your server is in PST or GMT, you can still display IST when displaying this with PHP.

$timezone = new DateTimeZone("Asia/Kolkata" );
$date = new DateTime();
$date->setTimezone($timezone );
echo  $date->format( 'H:i:s A  /  D, M jS, Y' );

Here is a list of supported timezones in PHP for your reference.

4 thoughts on “Display Indian current time in PHP

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s