Aditya Kumar
Aditya Kumar

Reputation: 9

How to calculate Week in jQuery DatePicker?

Is there any examples on how to return the week number of the selected date in DatePicker into another input type.

Upvotes: 0

Views: 4155

Answers (2)

Aditya Kumar
Aditya Kumar

Reputation: 9

I got the solution

$( "#pickdate" ).datepicker({ 
     onSelect: function(dateText, inst) {
        alert($.datepicker.iso8601Week(new Date(dateText)))
     } 
});

I think this will generate a week number for sure.

Upvotes: 1

njr101
njr101

Reputation: 9619

The datejs library is good for this sort of thing (as well as a lot of other date calculations). Check out the getWeek() function.

Upvotes: 1

Related Questions