As a programming novice, I am trying to display data from my database server on the web using a datatable in asp.net mvc. After following a tutorial video on YouTube, I encountered an issue where the date and time columns in my table are displaying as /Date(xxxxxxxxxxxxx)/ instead of the correct format. How can I fix this?
Below is the code snippet from my view page:
$(document).ready(function () {
$("#AttendanceTable").DataTable(
{
"ajax": {
"url": "/Attendance/GetList",
"type": "GET",
},
"columns": [
{ "data": "PersonInformationId" },
{ "data": "AttendanceTime" },
{ "data": "ActionType" },
]
public ActionResult GetList()
{
using (DBModel db = new DBModel())
{
var AttList = db.Attendances.ToList<Attendance>();
return Json(new { data = AttList }, JsonRequestBehavior.AllowGet);
}
I have come across suggestions to convert the JSON date to a normal date format in JavaScript, but I am unsure how to do this.