Skip to content

Instantly share code, notes, and snippets.

View fabiobranis's full-sized avatar
🤓
Coding

Fábio Branis fabiobranis

🤓
Coding
View GitHub Profile
@fabiobranis
fabiobranis / daysBetween.js
Created June 18, 2019 17:49
Simple function to calculate days difference - just a reminder
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;