Type Datetime incorrect format /Date(1566916268000)/ how to solve?

Asked

Viewed 30 times

0

The return of the Dt_start field returned from the Database is correct: 26/08/2019 11:08:10

But not in javascript is like this: /Date(1566916268000)/, see:

$.each(response.listar, function (index, item) {
    console.log("item.Dt_Inicio: " + item.Dt_Inicio); <-- /Date(1566916268000)/
});

I tried to make this conversion but it doesn’t work:

var _dt = new Date(item.Dt_Inicio.toLocaleString()); 
var dd = _dt.getDate();
var mm = _dt.getMonth() + 1;
var yyyy = _dt.getFullYear();

console.log("item.Dt_Inicio: " + dd + "/" + mm + "/" + yyyy);

NaN/NaN/NaN
  • on your console.log is returning exactly "Date(1566916268000)"? or is returning only the number "1566916268000"?

  • 1

    Hello! @Leonardo Getulio on my console returns /Date(1566916268000)/, but I found the solution as indicated on the top of the post, thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.