ISO8601 DateTime String to be displayed in local users timezone

133 views Asked by At

I have an ISO8601 datetime string retrieved from the server in UTC and would like to display it in the users local time in the following format.

YYYY/MM/DD - Hour:Mins:Seconds

How can I do this in javascript/jquery? Using momentjs is also acceptable.

1

There are 1 answers

2
sandyJoshi On BEST ANSWER

Using momentjs try the following snippet

moment(dateISOFormat).format('YYYY/MM/DD - HH:mm:ss');