Javascript Timezones List

admin

For example, If your time zone is GMT+2, -120 will be returned. Cooke clicker. Note: The returned value is not a constant, because of the practice of using Daylight Saving Time. Tip: The Universal Coordinated Time (UTC) is the time set by the World Time Standard. Note: UTC time is the same as GMT time. GMT: Vancouver: San Francisco: Seattle: Los Angeles: Denver: Mexico City: Houston: Minneapolis: New Orleans: Chicago: Montgomery: Indianapolis: Atlanta: Detroit. A timezone-enabled, drop-in replacement for the stock JavaScript Date. The timezoneJS.Date object is API-compatible with JS Date, with the same getter and setter methods - it should work fine in any code that works with normal JavaScript Dates. The timezoneJS.Date object gives you full-blown timezone support, independent from the timezone set on.

  1. Javascript Tolocalestring Timezone List
  2. Js Timezone List
  3. Moment Js Timezone List
  4. Javascript Moment Timezone List

Introduction

Standard JavaScript only supports two timezones, UTC and 'the local timezone being used when the browser was started'. On most platforms, it's not possible to change the local timezone of the browser without restarting the browser. In the cases where it is possible to change the local timezone without a browser restart, it has to be done at the operating system level and it's something a webpage can't request without the assistance of the user.
tzdata-javascript is a JavaScript library that enables the usage of multiple timezones on the same webpage without the assistance of the user.

World clock

Latest news

Javascript Tolocalestring Timezone List

  • 2016
    • 2016-12-24: Minor bugfix in the countdown demo to make it work a bit more reliable in Firefox.

Usage

Load the library

Add the following HTML snippet to the <head>-section of your HTML page.

Optionally change some settings

All settings are located under tzdata_javascript.settings.

Load and use timezones

Finally load and use one or more timezones. The timezones are specified using the well known names from the Olson database and can be loaded either synchronous or asynchronous. It's often simpler to use the synchronous interface, but it should be avoided if you use a lot of timezones that ain't cached already.

The asynchronous interface uses a call-back function.

The library has a 'localtime' time zone, you can use if you want to use the same functions as you use for the regular time zones from the Olson database. Internally, the 'localtime' time zone uses the standard getHours(), getMinutes() etc. functions of the Date object, completely bypassing the internal functions of the tzdata-javascript library.

Warning to users of Microsoft Windows

Since the 'localtime' time zone uses the functions provided by the operating system, not the tzdata-javascript library, faults in the operating system might appear when you use the 'localtime' time zone.
Microsoft is notoriously bad at keeping track of transition times between 'standard time' and 'summer time'. Users of Microsoft Windows should therefore be warned against using the 'localtime' time zone if they plan to use timestamps outside the current year.
Problems are VERY likely to show up! You have been warned!

As an example of the problem, let's compare the 'Europe/London' timezone and what Microsoft Windows users located in the UK will see if they use the 'localtime' time zone.
England ran an experiment in which they used GMT+1 the entire time between October 27th 1968 and October 31st 1971, i.e. 'summer time' all the time.
Epoch (timestamp=0) is defined as '1970-01-01 T 00:00:00.000 UTC'. Converted using the 'Europe/London' timezone that's '1970-01-01 T 01:00:00.000 BTS'. Note that the hours is '01' and the timezone abbreviation is 'BST', i.e. 'British Summer Time'.
Unfortunately for Microsoft Windows users in the UK, timestamp=0 will be converted to '1970-01-01 T 00:00:00.000' if they use the 'localtime' time zone. As you can see, the hours is '00', which is clearly wrong.
To confirm that this isn't a bug in the tzdata-javascript library, you can try running the following code on a Microsoft Windows machine located in England.

As you can see the code above does not use the tzdata-javascript library at all, so any errors in the output must come from somewhere else.
You're also more than welcome to run the code on Apple Mac OS, Linux or one of the BSDs. Neither of them should have any problems.

List of timezones

Js Timezone List

To get a list of (some of) the supported timezones, you can use this:

Due to the problem with Microsoft Windows mentioned above, 'localtime' was removed from the default list of time zones on November 22nd 2013.
You can still use the 'localtime' time zone, if you really want to, it just won't show up in any auto-generated list (e.g. drop-down menus) unless you actively take steps to make it so.

Javascript Timezones ListList

Features

  • Daylight Savings Time transitions are fully supported.

Moment Js Timezone List

Demos and examples

Javascript Moment Timezone List

  • Time compare
    Show the same point in time in multiple timezones. You can go back and forth in time (keep the buttons pressed to move faster through time) and change the timezones.
  • Timezone overview
    You can add and remove timezones on the fly. The selected timezones are stored in a cookie, so you get the same list of timezones next time you load the page.
  • World map
    A Google Map with 415 timezone markers. Hover over a marker to see the current time at that location. Click a marker to keep the info window open. It's possible to drag the map and zoom in and out.
  • Convert localtime
    Convert localtime time in one timezone to localtime in another timezone. Uses the strptime() function to parse the localtime in the first timezone and the strftime() function to show the localtime in the other timezone.
  • Simple canvas clock
    A simple analog clock drawn using HTML canvas.
  • Simple SVG clock
    Another simple analog clock. This one is using SVG.
  • Analog clock
    Same as above, but the SVG is in a file by itself, which should make it easier to replace the graphics with a 'prettier' version.
  • Analog clock 2
    Just to demonstrate how easy it is to replace the graphics. This one also shows the date, time, timezone abbreviation and timezone as text.
  • SVG
    SVG files can contain embedded JavaScript code. This demo doesn't use any HTML at all. Press the red button to change the timezone, the green button to change the timestamp (empty for a live clock), the blue button to scale the SVG image and the black button to do all of that in one go.
  • IP based
    Use the geolocation API from IP-API.com to find the users timezone. Then display a simple clock using that timezone.
  • Countdown
    Select a timezone and set an alarm in the given timezone. When the alarm goes off a message will be displayed or an URL will be loaded.

Copyright

You're only allowed to use the library, if you load it from this site as specified under Load the library above.

The data files are created by a simple conversion from the official tzdata. Since the original data from tzdata are public domain, so are the converted data files.

Contact

If you have any questions about the library, you're welcome to contact us:

  • Facebook: Tzdata-javascript
  • Twitter: @tzdatajs

Donations

If you think this project is useful, you're more than welcome to donate:

  • Bitcoins: 16P7ANsjD47bRaKyPwsBdoXSH2Q1mKSX8c
  • Flattr:
  • Paypal: [email protected] or https://paypal.me/tzdatajavascript