Re: [LIP] Time display in my choice of timezone using javascript

<[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <6481FDBB6566774BBF9EF12991DBC89A13C48797@i2km01-ukbr.domain1.systemhost.net>
I would stop living and coding in Gibraltar..

-----Original Message-----
From: linux-india-programmers-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:linux-india-programmers-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf
Of Binand Sethumadhavan
Sent: 14 June 2006 16:01
To: Technical discussions about programming under Linux systems; Babu
Kalakrishnan
Subject: Re: [LIP] Time display in my choice of timezone using
javascript


On 14/06/06, Babu Kalakrishnan <[email protected]> wrote:
> Don't think there's anything built into Javascript to handle timezones

> other than the local one.
>
> http://www.merlyn.demon.co.uk/js-date5.htm

Yeah, I did google and reach that page.

So here is what I am doing.

Create an instance of Date().

Use getUTC*() methods to get year, month etc. in UTC.

Hardcode my chosen zone's DST rules to convert the UTC timestamp to said
zone. The screw-up is that US/Eastern had one rule last year (2005),
another this year (2006), and yet another one next year (2007).

Adjust the hour/date/month/year for the difference (4h/5h). Handle month
changes, year changes, and even leap years :(

Look at cat /dev/urandom for slightly more readable code.

Binand


_______________________________________________
linux-india-programmers mailing list
linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/linux-india-programmers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.