In my MVC4 asp.net project, i am binding datetime from database to the view using ajax,
Here is the ajax code,
$.get(
'/Child/GetFamilyMemberView', { familyid: hv },
function (data) {
var html = "";
for (var i = 0; i < data.length; i++) {
html += "<p>" + data[i].Family_Member_DateofBirth + "</p>";
}
$("#getfamilymember").append(html);
});
After binding the datetime value to view, i get output as,
/Date(1104517800000)/
Any ideas why this is happening?
Please help,
Thanks
that is happening because your ajax is passing the data in JSON.
Use a function like this one to convert Json date to Javascript Date:
Update: use this http://www.mattkruse.com/javascript/date/ to format the javascript Date to string.
If you want to pass the date to string (mm/dd/yyyy):