Reputation: 799
I need to create a UTC timestamp which is in ISO format
I tried:
new Date().getTime().toISOString();
But I get Uncaught TypeError: (intermediate value).getTime(...).toISOString is not a function
Uncaught TypeError: (intermediate value).getTime(...).toISOString is not a function
Upvotes: 0
Views: 138
Reputation: 31
You can simply do new Date().toISOString();
new Date().toISOString();
Upvotes: 1
Reputation: 7618
getTime() returns the number of milliseconds since 1970, which is a number. toISOString() is a method of the Date object. you just want new Date().toISOString().
toISOString()
Date
new Date().toISOString()