Ken
Ken

Reputation: 4927

Convert time string to local time

Using the Github API I get times which look like this "2013-11-05T21:41:37Z", I think the 'Z' refers to zulu time i.e. UTC. What is the easiest way to convert this time to local time, using javascript (taking into account summer time changes)?

Upvotes: 0

Views: 96

Answers (2)

josh3736
josh3736

Reputation: 145062

moment is a great library for dealing with dates and times.

It supports parsing ISO date times.

Upvotes: 2

borbulon
borbulon

Reputation: 1411

new Date('2013-11-05T21:41:37Z') returns the user's computer's set timezone. It automatically converts it to local time for you.

Upvotes: 2

Related Questions