Date is not rendering as Date
Date is not rendering as Date
istudent_learning
Posts: 31Questions: 9Answers: 0
My table is getting /Date(1521706860000)/ as date.
{
"data": "OrderedDate",
"name": "OrderedDate",
"render": function (data) {
console.log("Data: " + data);
var date = new Date(data);
console.log("Date: " + date);
return date;
}
},
This discussion has been closed.
Answers
I used moment.js . Now it is working correctly.
"render": function (data) {
return moment(data).format("L");
}
The date string you are getting is the string representation of a
DateTime
that .NET uses. Either you'd need to convert it before sending it to the client-side, or use Moment (or similar) as you have done.Allan