'Date.now().toISOString() throwing error "not a function"
I am running Node v6.4.0 on Windows 10. In one of my Javascript files I am trying to get an ISO date string from the Date object:
let timestamp = Date.now().toISOString();
This throws: Date.now(...).toISOString is not a function
Looking through stackoverflow this should work...possible bug in Node?
Solution 1:[1]
If anybody wonder if you can convert excisting date.Now() timestamp to an actual date: yes, you can. Just:
new Date(put your timestamp here).toISOString().slice(0, 10)
and you will get date in yyyy-mm-dd format.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | meAndrew |
