Created
February 4, 2021 08:27
-
-
Save afrijaldz/8fbf9b21e052d0389a4458944aad7ecf to your computer and use it in GitHub Desktop.
get difference days from two days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const date1 = new Date('12/31/2020'); | |
const date2 = new Date(); | |
const difference = date1.getTime() - date2.getTime(); | |
const days = Math.abs(Math.ceil(difference / (1000 * 3600 * 24))); | |
console.log(days + ' days to go to new year!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment