In SQL Server Database the date showing as 06-Feb-17 7:42:14 PM. But in Jquery DataTable this date is showing as /Date(1486388669090)/
What I have to do if I want to show the date exactly as 06-Feb-17 7:42:14 PM format and "dd/mm/yy" format??
Here is my code:
$(document).ready(function () {
$('#myTable').DataTable({
"ajax": {
"url": "/Employees/LoadData",
"type": "GET",
"datatype": "json"
},
"columns" : [
{ "data": "EmployeeName", "autoWidth": true },
{ "data": "Department", "autoWidth": true },
{ "data": "Age", "autoWidth": true },
{ "data": "Gender", "autoWidth": true },
{
"data": "CreatedOn",// This is my date
}
]
});
});
Any appropriate help will be highly appreciated. Thanks!
You need to convert the date from epoch time to the time format you want. Try the MDN page for the Date Object. The constructor can take in the epoch time and the functions like getYear, getMonth and so forth will give you the parts for your date string.
To Display Json Date in "dd/mm/yyyy" Format:
And The date will will be displayed as: 06/02/2017
To Display Json Date exactly as "06-Feb-17 7:42:14 PM" Format:
And The date will will be displayed as: 06/02/2017 07:42:14 PM