Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript calculate days between dates

let startDate: string = "2021-04-01";
let date1: Date = new Date();
let date2: Date = new Date(startDate);
let timeInMilisec: number = date1.getTime() - date2.getTime();
let daysBetweenDates: number = Math.ceil(timeInMilisec / (1000 * 60 * 60 * 24));
 
PREVIOUS NEXT
Tagged: #typescript #calculate #days #dates
ADD COMMENT
Topic
Name
3+6 =