I'm trying to parse new Date("2021/09/21 18:59:00.000000")
but getting invalid Date
The problem occurred in safari and working fine in chrome.
Any Solution?
Asked
Active
Viewed 83 times
0

Álvaro González
- 142,137
- 41
- 261
- 360

MhkAsif
- 537
- 3
- 18
-
why did you use the PHP tag? – Syscall Jan 16 '22 at 08:36
-
Bcz Date is coming froom php server – MhkAsif Jan 16 '22 at 08:37
-
1You might try `let [Y,M,D,H,m,s,mu] = "2021/09/21 18:59:00.000000".split(/\D/); console.log(new Date(Y, M-1, D, H, m, s, mu.slice(0,3)));`. – RobG Jan 17 '22 at 12:53
1 Answers
-4
Just use:
new Date("2021/09/21 18:59:00")
and then add milliseconds.

camille
- 16,432
- 18
- 38
- 60

TOXIC DEVIL
- 1
- 4
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 16 '22 at 10:44