Possible alternative...
<script type="text/javascript">
String.prototype.toMMDDYY = function(sep) { // expects input format of YYMMDD to convert to MM/DD/YY
return this.substr(2,2)+sep+this.substr(4,2)+sep+this.substr(0,2)
}
// if short year IS KNOWN TO BE in this century
String.prototype.toMMDDYYYY = function(sep) { // expects input format of YYMMDD to convert to MM/DD/YYYY
var tdate = this;
return this.substr(2,2)+sep+this.substr(4,2)+sep+'20'+this.substr(0,2)
}
// whoops ... mis-read original request
String.prototype.toDDMMYY = function(sep) { // expects input format of YYMMDD to convert to DD/MM/YY
return this.substr(4,2)+sep+this.substr(2,2)+sep+this.substr(0,2)
}
// test of above
var str = '130125'; alert(str+' converts to '+str.toMMDDYY('/')+' or '+str.toMMDDYYYY('/')+' or '+str.toDDMMYY('/'));
str = '121225'; alert(str+' converts to '+str.toMMDDYY('-')+' or '+str.toMMDDYYYY('-')+' or '+str.toDDMMYY('-'));
</script>