Wednesday, April 08, 2009

How to find GMT time for partcular locations (country) using dynamically using php script?

Using Php Script:

function zonedate($layout, $countryzone, $daylightsaving) {

if ($daylightsaving) {

$daylight_saving = date('I');
if ($daylight_saving) {
$zone=3600* ($countryzone+ 1);
}
}
else {
if ($countryzone> >0){$zone= 3600*$countryzon e;}
else {$zone=0;}
}

$date=gmdate( $layout, time() + $zone);
return $date;
}

//I'm from north of spanish state, my GMT zone is -1, put yours and you will have the time,

$zonealDate = zonedate('d- m-y H:i a ',-1,true);

echo $zonealDate;

Using Javascript:

new date();

No comments: