0

I am javing a problem with date object, my problem is, I return an object without problem and it do JSON.parse perfectly, the problem is here I have this code

var citas = JSON.parse(data.citas);
$.each(citas, function(index, value) {
  console.log(value);
  console.log(value.fecha);
});

Here is my console.log() result

Object {id: 1, fecha: Object, hora: "17:45:32", confirmada: true, informe: ""…}
Object {timezone: Object, offset: 7200, timestamp: 1502920800}

the result is perfect but i want to conver value.fecha to the real date on my database I mean this example is 2017-08-17 and I want to transform the object date to this date, any idea??

Gamboa YGB
  • 82
  • 1
  • 9

1 Answers1

0

thanks new Date(value.fecha.timestamp*1000); is the solution, i was trying new Date(value.fecha.timestamp); without multiplicate

Gamboa YGB
  • 82
  • 1
  • 9