I have the following coming response from the database:
{
"createdAt": "1634413505432"
}
I want to convert this timestamp to something like 1 hour ago, 7 sec ago, 2 weeks ago based on the current date (new Date()). So I've tried to get the difference between the two dates but seems not working. maybe i'm doing it wrong.
Date.now() - 1634414179357 # i get 370517
new Date(370517 * 1000).getHours() # i get 8 which is wrong
Can someone show me how to do this.