I have two strings:
How can i calculate the difference between these two dates in weeks (52)?
Math.round(1387050870-(Math.round(new Date('2012-12-15').getTime()/1000))/604800), but that doesn't seem to work.
var a = new Date(1387050870 * 1000); var b = new Date("2012-12-15"); var weeks = Math.round((a-b)/ 604800000);
weeks 2239, which sounds close, since b is almost 43 years later * 52 weeks.
var date1 = new Date(1387050870 * 1000); var date2 = new Date("2012-12-15"); var dif = Math.round(date1-date2); alert(Math.round(dif/1000/60/60/24/7));
©2020 All rights reserved.