I am taking an XML feed and writing it to HTML using JavaScript.
The date field has:
20120319
What I want to do is convert it to a more readable format like:
03/19/2012
Is there an easy way of doing this in JavaScript?
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.
One way is to write:
which uses a regular expression to replace a sequence of four digits, followed by a sequence of two digits, followed by a sequence of two digits, with the second, plus a
/, plus the third, plus a/, plus the first.