Skip to content

Instantly share code, notes, and snippets.

@tandavala
Created August 28, 2020 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tandavala/463e3283128e20afa8f52c207d6a1a16 to your computer and use it in GitHub Desktop.
Save tandavala/463e3283128e20afa8f52c207d6a1a16 to your computer and use it in GitHub Desktop.
const unix_timestamp = 610329600000;
const date = new Date(unix_timestamp);
const calculate_age = (dob) => {
const diff_ms = Date.now() - dob.getTime();
const age_dt = new Date(diff_ms);
return Math.abs(age_dt.getUTCFullYear() - 1970);
};
console.log(date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment