Reputation: 104
I think this should work for me setting
$var = date('H:i');
echo $var;
and using the date()
function I will get the date and time for India. But I have changed the settings in php.ini
file to date.timezone = 'Asia/Kolkata'
but I'm still getting the wrong time.
How can I solve this problem?
Upvotes: 1
Views: 268
Reputation: 57322
use
date_default_timezone_set
— Sets the default timezone used by all date/time functions in a script
$timezone = "Asia/Calcutta";
if(function_exists('date_default_timezone_set')){
date_default_timezone_set($timezone);
echo date('H:i')
}
Upvotes: 1
Reputation: 5196
have you used
<?php
date_default_timezone_set('Asia/Kolkata');
?>
?
Upvotes: 1