I
I
IvanVvV2020-03-04 13:10:15
JavaScript
IvanVvV, 2020-03-04 13:10:15

How to create date and time on ios from a variable?

Why does it work like this in safari: but not like this:
var d = new Date("2021/01/01 00:00:00");

var dates = "2021/01/01 00:00:00";
var d = new Date(dates);

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Cheremkhin, 2020-03-04
@Che603000

Use the ISO format

var dates = "2020-03-04T14:42:29.097Z";
var d = new Date(dates);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question