Set the timezone for the script:
define('TIMEZONE', 'Asia/Calcutta'); // INDIA
date_default_timezone_set(TIMEZONE);
Get the default (script) timezone: date_default_timezone_get();
Get ini set timezone: ini_get('date.timezone');
Get timezone name: date("T");
Set timezone example: date_default_timezone_set('Europe/London'); // GMT
GMT to IST conversion example:
$event_length = 330; // IST is 5:30 ahead of GMT, so add 330 minutes
$timestamp = strtotime(date("H:i:s"));
$etime = strtotime("+$event_length minutes", $timestamp);
$ist_time = date('H:i:s', $etime);
echo '<br>'.'GMT - IST: '.$ist_time;
define('TIMEZONE', 'Asia/Calcutta'); // INDIA
date_default_timezone_set(TIMEZONE);
Get the default (script) timezone: date_default_timezone_get();
Get ini set timezone: ini_get('date.timezone');
Get timezone name: date("T");
Set timezone example: date_default_timezone_set('Europe/London'); // GMT
GMT to IST conversion example:
$event_length = 330; // IST is 5:30 ahead of GMT, so add 330 minutes
$timestamp = strtotime(date("H:i:s"));
$etime = strtotime("+$event_length minutes", $timestamp);
$ist_time = date('H:i:s', $etime);
echo '<br>'.'GMT - IST: '.$ist_time;
Comments
Post a Comment