How do I get a clock on my site showing Hawaii local time?

Discussion in 'HTML & Website Design' started by txwebdesign, Jul 31, 2007.

  1. #1
    I need to show a clock or digital time that displays the local Kauai, Hawaii time to users who will be accessing this page from places all over the world. I have seen world clock sites that have this information on their website but I am looking for a clock that I can move to my site so that they don't have to leave my site to see the Hawaii local time.

    Does anyone have any ideas on how to accomplish this?

    Thank you!
     
    txwebdesign, Jul 31, 2007 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's too bad nobody answered this. I'm sure there's some easy code out there that you could insert into your html page, like
    http://www.clocklink.com/ENG/gallery.htm

    I know that if you wanted, you could make a clock out of Flash using ActionScript. But then all your website viewers would need Flash player installed to see it.
     
    Stomme poes, Aug 3, 2007 IP
  3. Mike H.

    Mike H. Peon

    Messages:
    219
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Any Title</title>
    <script type="text/javascript">
    
    	var GMToffset = -4;  //Your CURRENT local offset, whether Daylight or Standard time.
    
    	function dispClock(){
    
    		var PM = false;
    		var refDate = new Date();
    		refDate.setHours(GMToffset+refDate.getHours()+refDate.getTimezoneOffset()/60);
    		document.getElementById('localDay').innerHTML = refDate.toString().substring(0,3);
    		document.getElementById('localDate').innerHTML = refDate.toString().substring(4,7)+" "+refDate.getDate()+" "+refDate.getFullYear();
    		var nHours = refDate.getHours().toString();
    		var nMins = refDate.getMinutes().toString();
    		if (nMins < 10){nMins = "0"+nMins}
    		if (nHours > 12){nHours = nHours-12; PM=true}
    		var timeStr =  nHours+":"+nMins;
    		if (PM){timeStr += " PM"} 
    		if (!PM && nHours != 12){timeStr += " AM"}
    		if (!PM && nHours == 12){timeStr += " PM"}
    		document.getElementById('localTime').innerHTML = timeStr;
    		setTimeout("dispClock()",60000);
    	}
    
    	onload=dispClock;
    
    </script>
    </head>
    <body>
              <table border='1' align='center' cellspacing='0' cellpadding='5' style='font-size:14pt'>
                   <thead>
                        <tr>
                             <th>
                                  Location
                             </th>
                             <th>
                                  Day
                             </th>
                             <th>
                                  Date
                             </th>
                             <th>
                                  Time
                             </th>
                        </tr>
                   </thead>
                   <tr>
                        <td align='center'>
                             Boston, MA
                        </td>
                        <td id='localDay' align='center'></td>
                        <td id='localDate' align='center'></td>
                        <td id='localTime' align='center'></td>
                   </tr>
              </table>
         </body>
    </html>
    
    Code (markup):
     
    Mike H., Aug 3, 2007 IP
  4. txwebdesign

    txwebdesign Peon

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That's a GREAT website. Thanks so much!
     
    txwebdesign, Aug 3, 2007 IP
  5. Mike H.

    Mike H. Peon

    Messages:
    219
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You're welcome. Obviously, Hawaii doesn't use DST, so you will never have to change the GMT offset.
     
    Mike H., Aug 3, 2007 IP