following function used to convert one date formate to another

Code:
function FormateDate(oldDate)
{
var newDate=new Date(oldDate.toString().split("-").reverse().join("-"));
return newDate;
}