How to set timezone in PHP for India
The PHP timezone for India is Asia/Kolkata
.
You can set it with date_default_timezone_set()
function.
Place this in the top of your code:
<?php
date_default_timezone_set("Asia/Kolkata");
?>
Example:
Echo the Server time and India time.
<?php
echo 'Server time: ' . date('d-m-Y H:i:s') . '<br>';
date_default_timezone_set("Asia/Kolkata");
echo 'India time: ' . date('d-m-Y H:i:s');
?>