V
V
Vyacheslav Shabunin2021-06-24 12:19:35
JavaScript
Vyacheslav Shabunin, 2021-06-24 12:19:35

How to parse time to understand JS?

Hello. The date and time comes from the server in the form: "07/24/2021 14:16:29". How it is possible to make this date and time understandable for JS?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2021-06-24
@fleshherbal

new Date(str.replace(/[\d.]+/, m => m.split('.').reverse().join('-')))

P
pLavrenov, 2021-06-24
@pLavrenov

Use moment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question