sylumer

elapsedDays

Dec 8th, 2021
953
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function elapsedDays(p_strDate)
  2. {
  3.     const dt1 = new Date(p_strDate);
  4.     const dtNow = new Date(Date.now());
  5.     const intMSPerDay = 1000 * 60 * 60 * 24;
  6.     const diffInTime = dtNow.getTime() - dt1.getTime();
  7.     return diffInDays = Math.round(diffInTime / intMSPerDay);    
  8. }
  9.  
  10. elapsedDays("2021-11-30" );
RAW Paste Data