Thomas Thomas - 4 years ago 84
Javascript Question

how to get a javascript date from a week number?

How i can get the date of the first day of a week from the week number and the year, in javascript (or jquery)?

example : week 30 , year 2013

thanks in advance !

Answer Source
var d = new Date(year, 0, 1);
var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];

d.setDate(d.getDate() + (week * 7));

console.log(days[d.getDay()]);

Try This

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download