programming-examples/js/Date/Write a JavaScript function to get the week end date..js

11 lines
235 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function endOfWeek(date)
{
var lastday = date.getDate() - (date.getDay() - 1) + 6;
return new Date(date.setDate(lastday));
}
dt = new Date();
console.log(endOfWeek(dt).toString());