Skip to content

Instantly share code, notes, and snippets.

@davidicus
Created September 10, 2018 18:31
Show Gist options
  • Save davidicus/12c736ae90f470933b202dab0b06fc3c to your computer and use it in GitHub Desktop.
Save davidicus/12c736ae90f470933b202dab0b06fc3c to your computer and use it in GitHub Desktop.
Millisecond math for common time spans used in timers like setTimeout and setInterval
// Math for common time spans used in timers like setTimeout and setInterval
// Once a minute
// there are 1000 milliseconds in a second and 60 seconds in a minute
1000 * 60
// Once an hour
// Same as above and there are 60 minutes in an hour
1000 * 60 * 60
// Once a day
// Same as above and there are 24 hours in a day
1000 * 60 * 60 * 24
// Once a week
// Same as above and there are 7 days in a week
1000 * 60 * 60 * 24 * 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment