Question: I want to convert dd/mm/yyyy to mm/dd/yyyy in javascript.

Answer: 
```
var months = new Array("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec");
var ddSplit = '12/23/2011'.split('/');  //date is mm/dd/yyyy format
alert(ddSplit[1]+'-'+months[ddSplit[0]-1] + '-' + ddSplit[2])

```
use this function

> 
> 
> 

```
function dateFormat(existingFormat,neededFormat,existingSeperator,newSeperator,dateValue)
{
        var exst    =    existingFormat.toLowerCase().split(existingSeperator);
        var d       =    dateValue.split(existingSeperator);
        d[exst[0]]  =    d[0];  d[exst[1]]=d[1];   d[exst[2]]=d[2];

        var newst    =    neededFormat.toLowerCase().split(existingSeperator);
        newDate      =    d[newst[0]] +newSeperator+d[newst[1]] +newSeperator+d[newst[2]];
        return(newDate); 

}
var dd    =    dateFormat('dd/yy/mm','mm/dd/yy','/','-','30/87/05');//dateFormat(existingFormat,neededFormat,existingSeperator,newSeperator,dateValue)

```

//use same name for date month and year in both formats 

You can use this function for converting any format date(including month date year only) to any format. :)