0
如何從jQuery 1.0中的兩個日期獲取週數?從兩個日期獲取周jQuery
我都試過,但沒有運氣:
//start and end date is in format '10-0ct-2015'
var end = $("span[id$=spEstDeliveryDate] input[type=text]").val();
var start = $("span[id$=spPODeliveryDate] input[type=text]").val();
var f = $.datepicker.parseDate("dd-M-yy", end);
var date1 = new Date(f);
date1 = (date1.getDate() + '/' + (date1.getMonth() + 1) + '/' + date1.getFullYear());
f = $.datepicker.parseDate("dd-M-yy", start);
var date2 = new Date(f);
date2 = (date2.getDate() + '/' + (date2.getMonth() + 1) + '/' + date2.getFullYear());
var totalWeeks = Math.floor((date1 - date2 + 1)/(1000 * 60 * 60 * 24)/7);