How to parse a date String containing a timezone?

4120 views javascript
-3

I have date in String:

let day = "12/07/1998 12:30 GMT+4"

How to convert it into a moment date? I tried

let d = moment(day, 'DD/MM/YYYY HH:mm')

But I don't know how to parse the timezone. I could not find it in the documentation

answered question

1 Answer

11

You can use the format method

moment("12/07/1998 12:30 GMT+4").format('DD/MM/YYYY HH:mm')

Refrence: https://momentjs.com/docs/#/displaying/format/

posted this

Have an answer?

JD

Please login first before posting an answer.

Ads

Categories