You can use the above described answer of momnet.js or the function below for splitting and using it
For using moment.js make sure you enter your old and new format in upper case
function parseDate(strDate) {
var dateFormat = $('#currentDateFormat').val();
var str;
var res;
var strFormat = dateFormat.split('.');
if (strFormat.length != 3)
strFormat = dateFormat.split('/');
if (strFormat.length != 3)
strFormat = dateFormat.split('-');
str = strDate.split('.');
if (str.length != 3)
str = strDate.split('/');
if (str.length != 3)
str = strDate.split('-');
if (strFormat[0].substr(0, 1) == 'd' && strFormat[1].substr(0, 1) == 'M' &&
strFormat[2].substr(0, 1) == 'y') // for dd MM yyyy
res = new Date(str[2], str[1], str[0]);
if (strFormat[0].substr(0, 1) == 'M' && strFormat[1].substr(0, 1) == 'd' &&
strFormat[2].substr(0, 1) == 'y') // for MM dd yyyy
res = new Date(str[2], str[0], str[1]);
if (strFormat[0].substr(0, 1) == 'y' && strFormat[1].substr(0, 1) == 'M' &&
strFormat[2].substr(0, 1) == 'd')
res = new Date(str[0], str[1], str[2]);
if (strFormat[0].substr(0, 1) == 'y' && strFormat[1].substr(0, 1) == 'd' &&
strFormat[2].substr(0, 1) == 'M')
res = new Date(str[0], str[2], str[1]);
return res;
}