Connecting Tech Pros Worldwide Forums | Help | Site Map

Getting client TimeZone name in JavaScript

Newbie
 
Join Date: Jan 2008
Posts: 17
#1: Jan 29 '08
i want to get client TimeZone name .for ex .if i am changing my timezone to CST it should change in my prgm thru javascript,and then it has to show the TimeZone name and current time also..

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jan 29 '08

re: Getting client TimeZone name in JavaScript


Welcome to TheScripts!

Use the Date object methods.
Newbie
 
Join Date: Jan 2008
Posts: 17
#3: Feb 5 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by acoder

Welcome to TheScripts!

Use the Date object methods.

not the time.. i want to get the timezone name .. for Ex.. now i am using IST ,if i am changing the India Standard Time to Eastern standad Time it has To change to EST ..
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Feb 5 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by praveen1983

not the time.. i want to get the timezone name .. for Ex.. now i am using IST ,if i am changing the India Standard Time to Eastern standad Time it has To change to EST ..

Make use of getTimezoneOffset(), toLocaleString(), etc. to calculate it yourself.
Newbie
 
Join Date: Jan 2008
Posts: 17
#5: Feb 6 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by acoder

Make use of getTimezoneOffset(), toLocaleString(), etc. to calculate it yourself.

i dont want a time.. i need a Eastern standard time this name to be changed..when i change my timezone to another
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Feb 6 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by praveen1983

i dont want a time.. i need a Eastern standard time this name to be changed..when i change my timezone to another

I know you want a timezone name rather than a time. What I'm saying is that you'll have to calculate the name of the timezone using the time.
Newbie
 
Join Date: Jan 2008
Posts: 17
#7: Feb 7 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by acoder

I know you want a timezone name rather than a time. What I'm saying is that you'll have to calculate the name of the timezone using the time.

k.. thank u for ur posts & replies
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#8: Feb 7 '08

re: Getting client TimeZone name in JavaScript


Quote:

Originally Posted by praveen1983

k.. thank u for ur posts & replies

No problem, glad to help. Post your solution here or, if you get stuck, post your code.
Newbie
 
Join Date: Mar 2008
Posts: 1
#9: Mar 27 '08

re: Getting client TimeZone name in JavaScript


I have the similar issue:

I want to get the time zone name from JavaScript and use that in Java.
TimeZone tz =TimeZone.getTimeZone("timezonenamegotfromjavascript");
.

Thanks for your help.
- jd
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#10: Mar 31 '08

re: Getting client TimeZone name in JavaScript


Read the answer I gave earlier. You'll have to program it yourself based on the time zone offset.
Reply


Similar JavaScript / Ajax / DHTML bytes