|
Code (php) <? function getLocaltime($GMT,$dst){ if(preg_match('/-/i',$GMT)) { $sign = "-"; } else { $sign = "+"; } $h = round((float)$GMT,2); $dst = "true"; if ($dst) { $daylight_saving = date('I'); if ($daylight_saving) { if ($sign == "-"){ $h=$h-1; } else { $h=$h+1; } } } // FIND DIFFERENCE FROM GMT $hm = $h * 60; $ms = $hm * 60; // SET CURRENT TIME if ($sign == "-"){ $timestamp = time()-($ms); } else { $timestamp = time()+($ms); } // SAMPLE OUTPUT $gmdate = gmdate("F d, Y - g:i A", $timestamp); return $gmdate; } echo ' Server Time: '.date("F d, Y - g:i A",time());; echo " || GMT Time: " . gmdate("F d Y - g:i A", time()); echo ' || Localtime: '.getLocaltime('+5.5',0); ?>
Ausome1 on July 18th, 2007 at 7:20 am #
You should also post your code on 2020code.com to promote your site and your code. Post a comment
|
|