Getting client TimeZone name in JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praveen1983
    New Member
    • Jan 2008
    • 17

    Getting client TimeZone name in JavaScript

    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
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TheScripts!

    Use the Date object methods.

    Comment

    • praveen1983
      New Member
      • Jan 2008
      • 17

      #3
      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 ..

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        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 getTimezoneOffs et(), toLocaleString( ), etc. to calculate it yourself.

        Comment

        • praveen1983
          New Member
          • Jan 2008
          • 17

          #5
          Originally posted by acoder
          Make use of getTimezoneOffs et(), 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

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            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.

            Comment

            • praveen1983
              New Member
              • Jan 2008
              • 17

              #7
              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

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                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.

                Comment

                • javadevloper
                  New Member
                  • Mar 2008
                  • 1

                  #9
                  I have the similar issue:

                  I want to get the time zone name from JavaScript and use that in Java.
                  TimeZone tz =TimeZone.getTi meZone("timezonenamegot fromjavascript");
                  .

                  Thanks for your help.
                  - jd

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

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

                    Comment

                    Working...