1

I have the following code in Javascript:

//obj.uploadDate = 1466679630387
temp = new Date(obj.uploadDate);
uploadDate =  temp.toString('yyyy-MM-dd HH:mm:ss');

For some reason, the value of uploadDate is NaN-NaN-NaN NaN:NaN:NaN, instead of a formatted date.

What could be the issue?

Omri
  • 1,216
  • 3
  • 22
  • 46

1 Answers1

0

Well, i had to convert to number, and now it's works great.

temp = new Date(Number(obj.uploadDate));
uploadDate =  temp.toString('yyyy-MM-dd HH:mm:ss');
Omri
  • 1,216
  • 3
  • 22
  • 46