Categories
JavaScript Answers

How to fix Date.now().toISOString() throwing error “not a function” with JavaScript?

Spread the love

To fix Date.now().toISOString() throwing error "not a function" with JavaScript, we call toISOString on a date object.

For instance, we write

const now = new Date();
const isoString = now.toISOString();

to create a new Date object now.

Then we call now.toISOString to return the datetime string from the date.

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 *