Currently I am getting date as string 1524801600000
. I want to convert it as new Date(2018, 4, 27)
.
How can I do that using jQuery or JavaScript?
Currently I am getting date as string 1524801600000
. I want to convert it as new Date(2018, 4, 27)
.
How can I do that using jQuery or JavaScript?
Just pass it to Date Constructor.
(+) Unary operator. Attempts to convert the operand to a number, if it is not already. more details here
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
var temp="1524801600000";
var p=new Date(+temp)
console.log(p)