A
A
AltaiR2019-11-07 13:55:48
JavaScript
AltaiR, 2019-11-07 13:55:48

How to convert date string to Date?

There is a string with a date in this format 11/22/2019 . You need to convert it to the Date format like this: Fri Nov 22 2019 00:00:00 GMT+0300 (Moscow Standard Time) . I also have date-fns connected to the project , can this be done with it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Somewhere Intech, 2019-11-07
@AltaiR-05

Tyk

new Date("12.03.2019".replace(/(\d+)\.(\d+)\.(\d+)/, "$3-$2-$1"));
//Tue Mar 12 2019 03:00:00 GMT+0300 (Москва, стандартное время)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question