Using the following:
var date = new Date(parseInt(jsonDate.substr(6)));
I get:
Mon Feb 22 1993 00:00:00 GMT+0000 (GMT Standard Time)
How do I format this too
22-02-1993
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use the
getFullYear,getMonth(note that the values start with0), andgetDatefunctions on theDateinstance, then assemble a string. (Those links are to the specification, which can be hard to read; MDC does a bit better.)Or use a library like DateJS (although it hasn’t been maintained in quite some time) or as joidegn mentions, moment.js.