var dayOfWeek = 5;//friday var date = new Date(2013, 10, 13); date.setDate(date.getDate() + (dayOfWeek + 7 - date.getDay()) % 7);