0

I am not able to convert into proper date like

29/9/2019

from the

\/Date(1567074191725)\/

data.

Sample data

[{"timestamp":"\/Date(1567074191725)\/","dataFrame":"ASQAAA=="}]

Code

var values = @Html.Raw(Json.Encode(ViewBag.records));

//data table code

{
    title: "DATE", data: "timestamp",
    render: function (data) {
        var updDate = UtcToIst(data);
        return updDate;
    }
},
function UtcToIst(data) {
    var dt = new Date(data);
    return dt;
kalehmann
  • 4,821
  • 6
  • 26
  • 36

1 Answers1

1

First of all, you need to extract the milliseconds of the data with substr method, and then you only pass this number to Date constructor.

new Date(parseInt(data.substr(6, 13)))
A. Moreno
  • 71
  • 4