Here is the Javascript html code for what you need , . Change the variables and you will be able to do any time zone.
Working Script demo:
http://www.htmlgoodies.com/legacy/be...p87effect.html
It was on first page of google searchCode:<SCRIPT LANGUAGE="javascript"> <!-- var adjust=0 var zone=" New Orleans" //This is the text that first appears denoting time zone gmtOffset=360 //setting this to your offset will start with your current time var PST=480 var EST=300 var TK=-540 var HW=600 var LD=0 var MX=360 var HK=-480 var FJ=-720 var ND=-330 function checkPST(){ clearTimeout(checkDateTime) gmtOffset=eval(PST+adjust) zone=" Pacific" checkDateTime() } function checkEST(){ clearTimeout(checkDateTime) gmtOffset=EST+adjust zone=" Eastern" checkDateTime() } function checkTK(){ clearTimeout(checkDateTime) gmtOffset=TK+adjust zone=" Tokyo" checkDateTime() } function checkHW(){ clearTimeout(checkDateTime) gmtOffset=HW+adjust zone=" Hawaii" checkDateTime() } function checkLD(){ clearTimeout(checkDateTime) gmtOffset=LD+adjust zone=" London(GMT)" checkDateTime() } function checkHK(){ clearTimeout(checkDateTime) gmtOffset=HK+adjust zone=" Hong Kong" checkDateTime() } function checkFJ(){ clearTimeout(checkDateTime) gmtOffset=FJ+adjust zone=" Aukland" checkDateTime() } function checkMX(){ clearTimeout(checkDateTime) gmtOffset=MX+adjust zone=" Mexico City" checkDateTime() } function checkND(){ clearTimeout(checkDateTime) gmtOffset=ND+adjust zone=" New Deli" checkDateTime() } function checkDateTime() { adjust=0 var today = new Date(); var year = today.getFullYear(); var month = today.getMonth()+1; var date = today.getDate(); var day = today.getDay(); var hour = today.getHours(); var minute = today.getMinutes(); var second = today.getSeconds(); //this next tidbit gets the last saturday in the month of Oct, for daylightsavings times purposes var lastSat lastSat=date-(day+1) while (lastSat<32){ lastSat+=7 } if (lastSat>31) lastSat+=-7 // this bit grabs the first saturday in april for the start of daylight time var firstSat firstSat=date-(day+1) while (firstSat>0){ firstSat+=-7 } if (firstSat<1) firstSat+=7 //adjust for windows95 daylight savings time changes if ((((month==4) && (date>=firstSat)) || month>4) && (month<11 || ((month==10) && day<=lastSat))){adjust+=60} yourOffset=(new Date()).getTimezoneOffset(); yourOffset = yourOffset+adjust ourDifference=eval(gmtOffset-yourOffset); var half=eval(ourDifference%60); ourDifference=Math.round(ourDifference/60); hour=eval(hour-ourDifference); var m = new Array ("mm","Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sept.","Oct.", "Nov.","Dec."); var leap=eval(year%4); if ((half==-30) || (half==30)) minute+=30; if (minute>59) minute-=60, hour++; if (minute<0) minute+=60, hour--; if (hour>23) hour-=24, date+=1; if (((month==4) || (month==6) || (month==9) || (month==11)) && (date==31)) date=1, month+=1; if (((month==2) && (date>28)) && (leap!=0)) date=1, month+=1; if ((month==2) && (date>29)) date=1, month+=1; if (hour<0) hour+=24, date-=1; if ((date==32) && (month==12)) month=m[1], date=1, year+=1 if (date==32) date=1, month+=1; if ((date<1) && (month==1)) month=m[12], date=31, year-=1 if (date<1) date=31, month-=1; if (((month==4) || (month==6) || (month==9) || (month==11)) && (date==31)) date=30; if ((month==2) && (date>28)) date=29; if (((month==2) && (date>28)) && (leap!=0)) date=28; for (i=1;i<13;i++){ if (month==i) {month=m[i]; break; } } //var dateTime = "" + ((hour >12) ? hour -12 :hour) var dateTime = hour; dateTime = ((dateTime <10)? "0":"") + dateTime; dateTime = " " + dateTime; dateTime += ((minute < 10) ? ":0" : ":") + minute; dateTime += ((second < 10) ? ":0" : ":") + second; //dateTime += (hour >= 12) ? " pm," : " am, "; dateTime += " " + month + " " + date + ", " + year; document.clock.face.value = dateTime; document.clock.locationx.value = zone; setTimeout("checkDateTime()",900); } // End --> </SCRIPT> <A name=here>//The HTML Portion Starts Here <BODY TEXT="#000000" BGCOLOR="#000000" onLoad="checkDateTime()"> <CENTER><B><FONT COLOR="#FFFFFF" size=+2>World Clock</FONT></B> <FORM name="clock"> <CENTER> <input type="text" name="face" size=31 value=""><br><br> <font color="#FFFFFF"> <b>Current Time Zone</b> </font> <br><INPUT TYPE="text" name="locationx" size=21 value=""> </CENTER><br> <TABLE border=1 cellpadding=5><tr> <TD><input type=button name=reset value="Pacific" onClick="checkPST()"></TD> <TD><input type=button name=reset value="Eastern" onClick="checkEST()"></TD> <TD><input type=button name=reset value=" Auckland " onClick="checkFJ()"></TD></TD><TD> <TD><input type=button name=reset value="Tokyo " onClick="checkTK()"></TD> <TD><input type=button name=reset value="London" onClick="checkLD()"></TD> <TD><input type=button name=reset value="Hong Kong" onClick="checkHK()"></TD></TR><TR> <TD><input type=button name=reset value="Hawaii" onClick="checkHW()"></TD> <TD><input type=button name=reset value="Mexico" onClick="checkMX()"></TD> <TD><input type=button name=reset value=" New Delhi " onClick="checkND()"></TD> </TR></table> </FORM> </CENTER>![]()








Reply With Quote



Bookmarks