javascript - Get date from JS Timestamp -


i have array "data" looks like

[1298214000000, "123456"]  

with

data[0] = 1298214000000 

when trying convert timestamp of data[0] date i

expect

sun feb 20 2011 16:00:00 gmt+0100 

instead get

mon mar 24 2014 23:27:43 gmt+0100 

which current date

i used

console.log(date(data[0]) 

and also

console.log(date(data[0].tostring())); 

none worked.

date constructor, use one:

console.log(new date(data[0]).tostring()); 

new date() create new date object.

simply calling function results in specific behaviour of date - return current date string (the string part documented in mdn, did not find specification current part).

note consistent other primitive constructors:

new boolean(): [object boolean] boolean(): false  new string(): [object string] string(): "" 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -