If you have an old UNIX timestamp in JavaScript… is there a way I can get the number of the age of that timestamp?
Like, the age of how old that unix timestamp is from when it is… to now.
Can you do that in JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming your timestamp is in milliseconds, you can get the the age in milliseconds using:
If your timestamp is in seconds, multiply it by 1000 before subtracting.
You can then divide by the appropriate factor to convert to seconds/minutes/hours etc. For example, to get the age in years, you would use: