Showing the time where I am 
Author Message
 Showing the time where I am

I am new to the Newsgroup and am searching for a script.  I have looked extensively at web sites that offer JavaScript, but I can't find what I need.  I need a script that will display the time where I am -- not the time where the person viewing the page is.  

We have a business in Hawaii and since many people are not sure what time it is out here, I want to display the current time in Hawaii next to our business hours so a person knows if we are open to be able to take phone orders.

I know very little about JavaScript but it seems to me that if a script can "retrieve" the time from the computer of a user, it should also be able to retrieve GMT and then convert that time by an amount written into a script so that the result shown would be Hawaiian Standard Time.  

If anyone has ever seen such a script or can offer any suggestions, I would sincerely appreciate it.  A big "mahalo" in advance for any help you can offer.

Steve Rummel



Mon, 16 Dec 2002 03:00:00 GMT  
 Showing the time where I am

<html>
<head>
<script>
function go() {
var now = new Date();
var milliTime =  Date.parse(now);
var UTCDate = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds());
var UTCmilliTime = Date.parse(UTCDate);
var myDiff = (milliTime - UTCmilliTime);
var islandDiff = 9*60*60*1000;
var islandTime = new Date(milliTime - (islandDiff + myDiff));
alert("Island time (in 24 hour time) is: " + islandTime.getHours() + ":" + islandTime.getMinutes());

Quote:
}

</script>
</head>
<body onload=go()>
</body>
</html>
The Island difference is nine, due to daylight savings. To make it good all year you would need to calculate the 'islandDiff' also.
--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm
I am new to the Newsgroup and am searching for a script.  I have looked extensively at web sites that offer JavaScript, but I can't find what I need.  I need a script that will display the time where I am -- not the time where the person viewing the page is.  

We have a business in Hawaii and since many people are not sure what time it is out here, I want to display the current time in Hawaii next to our business hours so a person knows if we are open to be able to take phone orders.

I know very little about JavaScript but it seems to me that if a script can "retrieve" the time from the computer of a user, it should also be able to retrieve GMT and then convert that time by an amount written into a script so that the result shown would be Hawaiian Standard Time.  

If anyone has ever seen such a script or can offer any suggestions, I would sincerely appreciate it.  A big "mahalo" in advance for any help you can offer.

Steve Rummel

  islandTime.htm
< 1K Download


Mon, 16 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Time function, displaying AM PM

2. Regular expression - It should be easy, but I am having a bad time

3. Show message for a certain time : how ?

4. show the time

5. How do I the default page in IIS to show last file date and time

6. Format Time Not to Show Seconds

7. Which function can show 'AM' or 'PM'?

8. Times Greek boldface/italic and Times vs Symbol

9. server time reported on .asp web pages, how do I report client side time correctly

10. Compare date in form with date/time in form with date/time in database

11. start date/time, end date/time problem

12. Design-Time license needed at run-time ?

 

 
Powered by phpBB® Forum Software