Re: Detect Tme Zone
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Thu, 13 Oct 2005 02:39:29 -0400
Trevor L. said the following on 10/13/2005 12:39 AM:
These statements display the current (local) time with UTC offset
They show the time as set on the computer, not necessarily the current local time.
var d = new Date() document.write (d)
For me, it displayed Thu Oct 13 14:36:20 UTC+1000 2005 (Australia is 10 hours ahead of UTC)
You could extract the offset itself by searching the string for "UTC" and taking the next 5 characters.
But it still may not be accurate, depending on the user's PC settings.
I display local time on my website by using the toLocale functions
function getTheDate() {// returns local date var now = new Date() return now.toLocaleDateString() } //------------------------------
function getTheTime() {// returns local time var now = new Date() return now.toLocaleTimeString() } //------------------------------ But
That doesn't show the time zone the user is in, it shows the time zone the users computer is set to. They may not always match. I live in one time zone if I travel 50 miles with my laptop, I am in a different time zone but I do not change my computer settings.
-- Randy comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly Answer:It destroys the order of the conversation Question: Why? Answer: Top-Posting. Question: Whats the most annoying thing on Usenet? .
- Follow-Ups:
- Re: Detect Tme Zone
- From: Trevor L.
- Re: Detect Tme Zone
- References:
- Detect Tme Zone
- From: Bruce A. Julseth
- Re: Detect Tme Zone
- From: Trevor L.
- Detect Tme Zone
- Prev by Date: update xml data with jscript/javascript
- Next by Date: Re: Detect Tme Zone
- Previous by thread: Re: Detect Tme Zone
- Next by thread: Re: Detect Tme Zone
- Index(es):
Relevant Pages
|