note 113195 modified in timezones.asia by derick

From: Date: Wed, 18 Sep 2013 10:44:12 +0000
Subject: note 113195 modified in timezones.asia by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196288@lists.php.net to get a copy of this message
I've tested "Asia/Calcutta" as well as "Asia/Kolkata" on PHP 5.4.7 and both returns accurate results. But I would suggest you to use "Asia/Kolkata" as "Calcutta" is now renamed to "Kolkata". <?php date_default_timezone_set("Asia/Kolkata"); echo date('d-m-Y H:i:s'); //Returns IST ?> --was-- I've tested "Asia/Calcutta" as well as "Asia/Kolkata" on PHP 5.4.7 and both returns accurate results. But I would suggest you to use "Asia/Kolkata" as "Calcutta" is now renamed to "Kolkata". <?php date_default_timezone_set("Asia/Kolkata"); echo date('d-m-Y H:i:s'); //Returns IST ?> On the other hand, you can also set the timezone to UTC, and later add 19800 seconds(Time offset) to get Indian Standard Time. <?php date_default_timezone_set('UTC'); $ist = strtotime('now') + 19800; echo date('d-m-Y H:i:s', $ist); ?> http://php.net/manual/en/timezones.asia.php

« previous php.notes (#196288) next »