I have one field where I enter GMT time of the upcoming match. Now I want to show IST time too along with GMT. i.e. I want to have two table td with one gmt and other IST. What should I put to make sure, it shows two different time zones.
To convert a timezone to your server localzone, use: // Converts from GMT to the server timezone echo date('Y-m-d H:i', strtotime('2008-10-09 08:55 GMT')); PHP: To specifically convert from GMT to IST: $current_date = date("Y-m-d H:i:s", mktime(date("H")+5.5,date("i"),date("s"),date("m"),date("d"),date("Y"))); echo $current_date; PHP: Second one not tested.
// SELECT TIME ZONE $sign = "+"; // Whichever direction from GMT to your timezone. $h = "6"; // Hour for time zone goes here e.g. +8 or -4, just remove the + or - $dst = "false"; // Just insert "true" if your location uses daylight savings time or "false" if it does not // DETECT AND ADJUST FOR DAYLIGHT SAVINGS TIME 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("l, dS F Y, g:i:s A", $timestamp); echo "<td class='tpmiddle'>".$gmdate."</td>";