vread
vread

Reputation:

get current time based on timezoneid in javascript

Is there any way to get the current time for a particular timezone (ex: var currentTime=getCurrentTime(timezoneId) where timezoneId="alaska" or Eastern Time), including Day Light Saving in javascript.

Upvotes: 1

Views: 3115

Answers (2)

bobince
bobince

Reputation: 536339

Timezone handling isn't built into JavaScript, so you'd need a library containing all the timezone details (usually generated from the Olson database). eg. fleegix.date has one.

See also How do I determine the system's Olson zoneinfo in JavaScript?

Upvotes: 2

unwind
unwind

Reputation: 399703

This looks like a solution, although it uses city names as references.

Upvotes: 1

Related Questions