Place Timezone information into a cookie with JavaScript

by ian.purton

This JavaScript will pick up the users timezone offset and place it nto a cookie. This is useful for when you want to diaply times in your web application taking the users location into account.

As the timezone is placed in a cookie it can be extracted by any serverside scripting technology. Javascript returns the timezone information in minutes so the script converts it into hours.

This entry was posted on Friday, March 3rd, 2006 at 2:42 am and is filed under Javascript. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

  • Sachin Gedam
    Its really a useful way to get timezone information.. but there is a problem with this solution...there are many time zones which shares same GMTOffset, so how can identify exact time zone on server side based on GMTOffSet.

    For example:
    Beijing
    Perth
    Taipei
    Kula Lumpur

    these time zone sharing same GMT Offset (+8:00), so when i receive GMTOffset than at server side i may not be able to get exact time zone.
blog comments powered by Disqus