Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Coding

Fábio Branis fabiobranis

🤓
Coding
View GitHub Profile
@fabiobranis
fabiobranis / daysBetween.js
Created Jun 18, 2019
Simple function to calculate days difference - just a reminder
View daysBetween.js
const daysBetween = ( date1, date2 ) => {
//Get 1 day in milliseconds
let one_day=1000*60*60*24;
// Convert both dates to milliseconds
let date1_ms = date1.getTime();
let date2_ms = date2.getTime();
// Calculate the difference in milliseconds
let difference_ms = date2_ms - date1_ms;