I'm assuming
a.EnterDate is a DateTime or Date type,
timesheet.CaptureDate is the string return by the datepicker plugin
You didn't mention what the issue was. I further assume that the code threw error??? because the code is trying to compare a string and a Date?
There are couple of things to look at.
1. The datepicker date format. Make sure you coded it to return date format like 05/28/2017 or however the requirements are.
$(function () {
$('#CaptureDate').datepicker({
dateFormat: 'mm/dd/yy'
});
});
2. Here is one of the option. Convert the EnterDate into string with format mm/dd/yyyy and compare it with CaptureDate. Again, I further assumed that the EnterDate does not allow null. If it does, change the code to get the month to "a.EnterDate.Value.Month"
var timesheets = db.Timesheets.Include(t => t.Client).Include(
t => t.Consultant).Where(a => a.ConsultantNum == timesheet.ConsultantNum &&
SqlFunctions.Replicate("", 2 - SqlFunctions.StringConvert((double)a.EnterDate.Month).TrimStart().Length) +
SqlFunctions.Replicate("0", 2 - SqlFunctions.StringConvert((double)a.EnterDate.Month).TrimStart().Length) +
SqlFunctions.StringConvert((double)a.EnterDate.Month).TrimStart() +
SqlFunctions.Replicate("/", 2 - SqlFunctions.StringConvert((double)a.EnterDate.Month).TrimStart().Length) +
SqlFunctions.Replicate("0", 2 - SqlFunctions.DateName("dd", a.EnterDate).Trim().Length) +
SqlFunctions.DateName("dd", a.EnterDate).Trim() + "/" +
SqlFunctions.DateName("year", a.EnterDate) == timesheet.CaptureDate).ToList();