Is there a way to change the format of "20150812" to "12-08-2015"? Below is the date object that I am working with:
study response = [
{
"dob": {
"Value": [
"20151208"
]
}
}
]
Javascript function
var dob = study["dob"]["Value"]; //returning 20151208
Expected output //08-12-2015
I've attempted the following:
Date.parse(dob); //return NaN
Any assistance would be greatly appreciated.