Categories
JavaScript Answers

How To Change an ISO Date String to a JavaScript Date Object?

Spread the love

To change an ISO date string to a JavaScript date object, we can use the Date constructor to convert it to a JavaScript date object.

For instance, we can write:

const d = new Date('2021-11-03T19:00:34.203Z');
const n = d.getUTCDate();

We just pass the ISO date string as the argument of the Date constructor.

Then we call getUTCDate to return the date of the month in UTC.

Therefore, n is 3.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *