I have a datepicker in 2 textboxes , in am trying to add the value of these text boxes to a function that needs a valid Javascript Date.
This is the part of the function - start is a Date
else if (daystosearch == 'custom') {
start.setDate(Date.parse($('#<%= tStartDate.ClientID %>').val()));
end.setDate(Date.parse($('#<%= tEndDate.ClientID %>').val()));
}
Date.Parse will not work , because value of the textbox is "10/29/2012" which is not a parsable date. How can I use start.setDate and get the value of the textboxes date ?
Date.parseshould be more than able to parse this format10/29/2012. Just tryDate.parse('10/29/2012')in your browser console and you'll see it gets parsed