i have written a get api and i want to show some records in data table, while im getting records in json im getting date values like this "/Date(1498849454000)/". How to get date value in "2017-04-11 02:09" in this format. data is stored correctly "2017-04-11 02:09:17.000". data type - datetime
sample data
{"data":[{"updtd_date":"\/Date(1498849454000)\/","usecase":"watertank","id":1026,"sms":"Alert: Tank is Full at 01/07/2017 12:33:51 AM ]"},
code
<script>
$(document).ready(function () {
$('#myTable').DataTable({
"ajax": {
"url": "url",
"type": "GET",
"datatype": "json"
},
"columns" : [
{ "data": "updtd_date", "autoWidth": true },
{ "data": "usecase", "autoWidth": true },
{ "data": "id", "autoWidth": true },
{ "data": "sms", "autoWidth": true }
]
});
});
</script>
<table id="myTable">
<thead>
<tr>
<th>Time</th>
<th>Use Case</th>
<th>Sl no</th>
<th>SMS</th>
</tr>
</thead>
</table>
controller
public ActionResult getSMS()
{
using (smartpondEntities dc = new smartpondEntities())
{
var data = dc.sms.OrderByDescending(a => a.id).ToList();
return Json(new { data = data }, JsonRequestBehavior.AllowGet);
}
}