function PreviousWeek() { function getPreviousWeekDay(now, d) { var x = ((d) - now.getDay()); now.setDate(now.getDate() + x - 7); return now; } var now = new Date(); var previousMonday = getPreviousWeekDay(new Date(), 1); var previousTusday = getPreviousWeekDay(new Date(), 2); var previousWensday = getPreviousWeekDay(new Date(), 3); var previousThirsday = getPreviousWeekDay(new Date(), 4); var previousFriday = getPreviousWeekDay(new Date(), 5); var previousSaturday = getPreviousWeekDay(new Date(), 6); var previousSunday = getPreviousWeekDay(new Date(), 7); $('#lbl1').html(previousMonday.format('yyyy-MM-dd')); $('#lbl2').html(previousTusday.format('yyyy-MM-dd')); $('#lbl3').html(previousWensday.format('yyyy-MM-dd')); $('#lbl4').html(previousThirsday.format('yyyy-MM-dd')); $('#lbl5').html(previousFriday.format('yyyy-MM-dd')); $('#lbl6').html(previousSaturday.format('yyyy-MM-dd')); $('#lbl7').html(previousSunday.format('yyyy-MM-dd')); function NextWeek() { function getNextWeekDay(now, d) { var x = ((d) - now.getDay()); now.setDate(now.getDate() + x + 7); return now; } var now = new Date(); var nextMonday = getNextWeekDay(new Date(), 1); var nextTusday = getNextWeekDay(new Date(), 2); var nextWensday = getNextWeekDay(new Date(), 3); var nextThirsday = getNextWeekDay(new Date(), 4); var nextFriday = getNextWeekDay(new Date(), 5); var nextSaturday = getNextWeekDay(new Date(), 6); var nextSunday = getNextWeekDay(new Date(), 7); $('#lbl1').html(nextMonday.format('yyyy-MM-dd')) $('#lbl2').html(nextTusday.format('yyyy-MM-dd')) $('#lbl3').html(nextWensday.format('yyyy-MM-dd')) $('#lbl4').html(nextThirsday.format('yyyy-MM-dd')) $('#lbl5').html(nextFriday.format('yyyy-MM-dd')) $('#lbl6').html(nextSaturday.format('yyyy-MM-dd')) $('#lbl7').html(nextSunday.format('yyyy-MM-dd'))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)