How to get uclibc style timezone string (e.g GMT+0IST-1,M3.5.0/01:00:00,M10.5.0/02:00:00)from javas

R

Rohit

I am trying to get client machine's timezone from my java script . But
i have no idea how would i be able to get it in uclibc format. (e.g.
GMT+0IST-1,M3.5.0/01:00:00,M10.5.0/02:00:00) . I saw couple of posting
on net from which suggest getTimezoneoffset or may be calculation with
dates from script gives correct offset including day light saving
time but i am not sure how correct this is. Again even if its
correct , its not telling me when (exact date and time )day light
saving adjustment starts and ends which is last part of /etc/TZ
string, Is there a way to get this from java script.

-- Rohit
 
D

Dr J R Stockton

I am trying to get client machine's timezone from my java script . But
i have no idea how would i be able to get it in uclibc format. (e.g.
GMT+0IST-1,M3.5.0/01:00:00,M10.5.0/02:00:00) . I saw couple of posting
on net from which suggest getTimezoneoffset or may be calculation with
dates from script  gives correct  offset including day light saving
time but i am not sure how correct this is. Again even if its
correct , its not telling me when (exact date and time )day light
saving adjustment starts and ends which is last part of /etc/TZ
string, Is there  a way to get this from java script.

You mean JavaScript; or you mean Java and are in the wrong place.
And I guess you mean BST not IST. That is not a timezone; a timezone
reflects only Standard (Winter) Time, and does not change with the
seasons. The timezone corresponds to the first number in the string.

My Web page <URL:http://www.merlyn.demon.co.uk/js-date5.htm> does
rather the opposite. And <URL:http://www.merlyn.demon.co.uk/js-
date2.htm>
shows how to determine the transitions for a given year. That, done
for
a few years, should enable the numerical part of the string to be
determined

The acronyms cannot in general be obtained. In any case, they are not
well-defined.
 
R

Rohit

You mean JavaScript; or you mean Java and are in the wrong place.
And I guess you mean BST not IST. That is not a timezone; a timezone
reflects only Standard (Winter) Time, and does not change with the
seasons. The timezone corresponds to the first number in the string.

My Web page <URL:http://www.merlyn.demon.co.uk/js-date5.htm> does
rather the opposite. And <URL:http://www.merlyn.demon.co.uk/js-
date2.htm>
shows how to determine the transitions for a given year. That, done
for
a few years, should enable the numerical part of the string to be
determined

The acronyms cannot in general be obtained. In any case, they are not
well-defined.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ...

No no acronym are not real concern. I just put on string for example.
By timezone here what i really mean is string which indicates
following things.
(TZ env variable in embedded systems if you happen to know)

Need to know offset from GMT : e.g. GMT+5:30
Start of Daylight saving time : M3.5.0/01:00:00 : meaning at 1 on 0
th day(sunday), Week 5
Month: March
End of Daylight saving time : M10.5.0/02:00:00 : meaning at 2 on
0th day(sunday), Week 5
Month: October

--Rohit
 
D

Dr J R Stockton

In comp.lang.javascript message <bc9900b0-ff89-4136-be7c-4df69a07c17d@u3
6g2000prf.googlegroups.com>, Wed, 2 Jul 2008 06:33:25, Rohit
(TZ env variable in embedded systems if you happen to know)

If you had troubled to read the references provided, you would have
known that I know about TZ, which is not restricted to embedded systems.
You should also read FAQ 2.3.

Any implementation should test with future years, in order not to rely
unnecessarily on agents honouring the last two paragraphs of ISO/IEC
16262 15.9.1.8. It should use leap years for the tests, in order to be
able to discriminate between week designators 4 & 5 in any month. Note
that the USA would presumably put its clocks back in February if it were
moved into the South Pacific.

Would a solution giving times one second earlier be acceptable? It
seems easier.
 
R

Rohit

In comp.lang.javascript message <bc9900b0-ff89-4136-be7c-4df69a07c17d@u3
6g2000prf.googlegroups.com>, Wed, 2 Jul 2008 06:33:25, Rohit


If you had troubled to read the references provided, you would have
known that I know about TZ, which is not restricted to embedded systems.
You should also read FAQ 2.3.

Oh i did not mean in that sense. On my desktop fedora box i see quite
some information in /etc/localtime and the last line is this string
but on the embedded box its just the string i typed above. And i want
to read timezone "info" from the client box and put that on my
embedded box. What i meant by TZ env in embedded system is string in
this format only and not in other format which are also legitimate.
After searching for info ,looks like there is no ready-to-use api/
object for this. So i will have to construct this string by getting
offset from GMT for this timezone, and DST start and end.
Any implementation should test with future years, in order not to rely
unnecessarily on agents honouring the last two paragraphs of ISO/IEC
16262 15.9.1.8. It should use leap years for the tests, in order to be
able to discriminate between week designators 4 & 5 in any month. Note
that the USA would presumably put its clocks back in February if it were
moved into the South Pacific.
Would a solution giving times one second earlier be acceptable? It
seems easier.

Yeah it would be acceptable. But may be i still fail to see how you
can get this string.Can you provide the solution , snippet from
javascript /java code here ?
I have also started separate thread for this question. Please take a
look at

http://groups.google.com/group/Goog...d48221bdbe9/f0a93a1fabaffe23#f0a93a1fabaffe23

Thanks ,
Rohit
 
D

Dr J R Stockton

I have also started separate thread for this question.

Discussion fragmentation is deeply annoying, and leads to a loss of
interest in helping you.

Don't refer to articles by display position; that dependa in the
reading agent and its settings. Give thread subject, date, author,
message-ID.

Be aware that excessively long Subjects are a PITA.

Read, understand, and follow the newsgroup FAQ and the other links
provided.
 
R

Rohit

Discussion fragmentation is deeply annoying, and leads to a loss of
interest in helping you.
Yes but if you can divide the problem in multiple components and each
can be individually answered, i do not see any problem in this. If
they are related provide the link . (Thats how things anyway get
related).
Don't refer to articles by display position; that dependa in the
reading agent and its settings. Give thread subject, date, author,
message-ID.

Be aware that excessively long Subjects are a PITA.
Agreed but its not just you and me out there. There are people who
kind of expect enough description in subject so they can decide
whether to click there or not. Please do not impose your style upon
others.
Read, understand, and follow the newsgroup FAQ and the other links
provided.
I have done this but there are quite few good ways to do same thing
and not one always. We do not need to agree on each aspect of this
thing unless things go really bad. Having said that i still see your
point of short subject as valid but i do not understand why should
that make someone who is there to answer questions NOT respond to the
actual question.

Thanks,
Rohit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top