Hi,
 This is php code for change time according to time zone.
<?php
//set local timezone
date_default_timezone_set("Europe/Paris");
//get server time as a unix timestamp
$unixtime = strtotime($servertime . ' EST'); //append EST to denote New York time
//convert to human readable local time
echo 'server time is '.date('r', $unixtime);
?>
Hi,
This is another way ...
<?php
echo "Original Time: ". date("h:i:s")."n";
putenv("TZ=US/Eastern");
echo "New Time: ". date("h:i:s")."n";
?>
Hi,
<?php
// Convert current servertime to GMT so the local time can be calculated
function fetchGMT()
{
    return mktime () + ((date('O')/100 )/-1)*60*60 ;
}
Â
// What is the hour offset for OUR timezone?
// We are in GMT -6, so -6 is our offset!
$localoffset=-6 ;
$gmt=fetchGMT();Â Â // Get GMT time
$timezoneoffset=$localoffset* 60*60; // Get offset between local and GMT
$local_time=$gmt+$timezoneoffset ; // Add offset to get local time Â
?>
|
My Blog Title
|