Difference in days between two dates


/ Published in: JavaScript
Save to your folder(s)

Returns the differencia in days between tw dates


Copy this code and paste it in your HTML
  1. //Diferencia en días entre dos fechas
  2. Date.difDias(fecha1,fecha2) {
  3. return Math.ceil(Math.abs((fecha1.getTime() - fecha2.getTime())/(24*60*60*1000)));
  4. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.