I am posting DateTime value as a String Via AJAX POST to MVC Action for saving this Value.
But at the Time of Saving the Value in MVC Action, I get the error message in My AJAX response as:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value
My AJAX POST is as,
String dateTime="2013-07-25 11:59:22 PM";
$.ajax({
type:'POST',
url:'SaveSchedule',
data:{start:dateTime},
success:function(data){ }
});
and MVC Action as,
[HttpPost]
public ActionResult SaveSchedule(DateTime start)
{
var schedule = new Schedule { StartTime = start};
db.Schedules.Add(schedule);
db.SaveChanges();
var temp = 0;
return Json(temp);
}