Converting 10 Digit Timestamp to Date
Converting/reading 10 digit timestamp might seem confusing. I found this value in a field of a JSON response from an API where I was expecting a date. At the first, I couldn't figure out how to convert it to date for UI. After some research I found that the 10-digit timestamps represent the number of seconds.
1 2 3 4 5 6 7 8 9 10 11
// Timestamp const ts = 1504095567183 // Native new Date(ts) // Moment.js moment(ts) // day.js dayjs.unix(ts)