0

I am trying to get a date in the following format using javascript only.How can I get the name of timezone which I guess is ([Europe/London]) in this case? Note: javascript only please :-)

2016-12-27T20:16:12.752+0000[Europe/London]
The format is: yyyy-MM-dd'T'HH:mm:ss.SSSZ'['VV']'

The Date methods like new Date() and toISOString() are available however they don't provide name of timezone .What else can be done? Any suggestion is really appreciated.

iCodes
  • 1,382
  • 3
  • 21
  • 47
  • Possible duplicate of [Getting the client's timezone in JavaScript](http://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript) – Cymen Mar 04 '16 at 06:49
  • I dont think converting from time zone to a name of place can be done as more than one place can be in a particular timezone from north to south. Unless you do some pre standard mapping of one time zone to one place or use the users current coordinate. – Pravin Mar 04 '16 at 06:51

1 Answers1

1
Intl.DateTimeFormat().resolvedOptions().timeZone

reference: http://www.ecma-international.org/ecma-402/1.0/

huli
  • 101
  • 1
  • 6
  • Note you'll need a polyfill for Intl depending on browser support required: http://caniuse.com/#search=intl – Cymen Mar 04 '16 at 06:51