Jameel Jameel - 1 year ago 129
jQuery Question

Jquery to get Friday's Date of Current Week from Current Date

Trying to get Friday's date of current week from current date (today's date) using JQuery.

Something like below:(this doesn't work)

var curr = new Date;
var fridayDate = new Date(curr.setDate(curr.getDate() - curr.getDay()+4));

Thanks in advance!

Answer Source
new Date().getDay();  //0=Sun, 1=Mon, ..., 6=Sat

This is how to get Weekday.

friday is 5. so, try this one

var curr;
curr = new Date();
var fridayDate;
fridayDate = new Date();
var friday;
friday = 5 - curr.getDay();