Skip to content

Instantly share code, notes, and snippets.

@Avaray
Created September 24, 2022 18:19
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 Avaray/12854152d7d9bda9efa080b485dc74b6 to your computer and use it in GitHub Desktop.
Save Avaray/12854152d7d9bda9efa080b485dc74b6 to your computer and use it in GitHub Desktop.
Calculate Days / Hours / Minutes / Seconds between two dates in JavaScript
// days between
(b - a) / (1000 * 60 * 60 * 24)
// minutes between
(b - a) / 60000
// seconds between
(b - a) / 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment