Adding week number and week ranges of a year to DropDown List in ASP.NET3.5 using JQUERY
I am learning jQuery. Here I have a requirement i.e I have to add Week number and W开发者_如何学Ceek ranges of a year to DropDown List in ASP.NET3.5. And I have to pass selected week range to database. I am using c#.net. This should be done automatically for every year.
How can I do this using JQUERY?
Regards,
JN
try this
function getDateRangeOfWeek(weekNo){
var d1 = new Date();
numOfdaysPastSinceLastMonday = eval(d1.getDay()- 1);
d1.setDate(d1.getDate() - numOfdaysPastSinceLastMonday);
var weekNoToday = d1.getWeek();
var weeksInTheFuture = eval( weekNo - weekNoToday );
d1.setDate(d1.getDate() + eval( 7 * weeksInTheFuture ));
var rangeIsFrom = eval(d1.getMonth()+1) +"/" + d1.getDate() + "/" + d1.getFullYear();
d1.setDate(d1.getDate() + 6);
var rangeIsTo = eval(d1.getMonth()+1) +"/" + d1.getDate() + "/" + d1.getFullYear() ;
return rangeIsFrom + " to "+rangeIsTo;
};
answer is originally from
http://snipplr.com/view/7540/get-date-range-from-week-number-in-year/
精彩评论