Answers for "calculate weeks between two dates javascript"

5

How do I get the number of days between two dates in JavaScript

let today = new Date().toISOString().slice(0, 10)

const startDate  = '2021-04-15';
const endDate    = today;

const diffInMs   = new Date(endDate) - new Date(startDate)
const diffInDays = diffInMs / (1000 * 60 * 60 * 24);


alert( diffInDays  );
Posted by: Guest on August-07-2021
0

js date in two weeks

date1.setDate(date.getDate() + 14);
Posted by: Guest on November-17-2020

Code answers related to "calculate weeks between two dates javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language