function CFecha(f){
	var strDay;
	var strMonth;
	var strYear;
	var sep;
	var res;
	var c;
	
	c = 0;
	sep = f.substr(3, 1);
	if(isNaN(sep)==true){
		strYear = f.substr(4, 4);
		strMonth = f.substr(2, 1);
		strDay = f.substr(0, 1);
		res = strYear + "0" + strMonth + "0" + strDay;
	}
	else{		
		sep = f.substr(4, 1);
		if(isNaN(sep)==true){
			strYear = f.substr(5, 4);
			sep = f.substr(2, 1);
			if(isNaN(sep)==true){
				strMonth = f.substr(3, 1);
				strDay = f.substr(0, 2);
				res = strYear + c + strMonth + strDay;
			}
			else{
				strMonth = f.substr(2, 2);
				strDay = f.substr(0, 1);
				res = strYear + strMonth + c + strDay;
			}
		}		
		else{
			sep = f.substr(5, 1);
			if(isNaN(sep)==true){
				strYear = f.substr(6, 4);
				strMonth = f.substr(3, 2);
				strDay = f.substr(0, 2);
				res = strYear + strMonth + strDay;
			}		
		}
	}

	return res;
}
function prfecha(){
	alert(CFecha(document.FormC.info1005.value));
}
<!-- Begin
function  checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("Formato de fecha incorrecto, pruebe dd-mm-aaaa");
datefield.focus();
return false;
}
else {
return true;
   }
}
function chkdate(objName) {
//var strDatestyle = "US"; //United States date style
var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Enero";
strMonthArray[1] = "Febrero";
strMonthArray[2] = "Marzo";
strMonthArray[3] = "Abril";
strMonthArray[4] = "Mayo";
strMonthArray[5] = "Junio";
strMonthArray[6] = "Julio";
strMonthArray[7] = "Augosto";
strMonthArray[8] = "Septiembre";
strMonthArray[9] = "Octubre";
strMonthArray[10] = "Noviembre";
strMonthArray[11] = "Diciembre";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}

if (strYear != null) {
	if (strYear.length == 2) {
	strYear = '20' + strYear;
	}
	if ((strYear.length == 3)||(strYear.length > 4)) {
	return false;
	}
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(strDay)==true) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(strMonth)==true) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(strYear)==true) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
// AQUÍ ES ON ES CONSTRUEIX LA DATA RESULTANT
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + "/" + intMonth + "/" + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
//  End -->

function chkdateddmm(objName) {
//var strDatestyle = "US"; //United States date style
var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Enero";
strMonthArray[1] = "Febrero";
strMonthArray[2] = "Marzo";
strMonthArray[3] = "Abril";
strMonthArray[4] = "Mayo";
strMonthArray[5] = "Junio";
strMonthArray[6] = "Julio";
strMonthArray[7] = "Augosto";
strMonthArray[8] = "Septiembre";
strMonthArray[9] = "Octubre";
strMonthArray[10] = "Noviembre";
strMonthArray[11] = "Diciembre";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
   }
}

// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(strDay)==true) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(strMonth)==true) {
err = 3;
return false;
   }
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
}
// AQUÍ ES ON ES CONSTRUEIX LA DATA RESULTANT
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday;
}
else {
datefield.value = intday + "/" + intMonth;
}
return true;
}

function reverseFecha(texto){
  var txtfecha, vpartes, i ;
  vpartes = texto.split("/");
  return vpartes[1]+"/"+vpartes[0]+"/"+vpartes[2];
}

function FromFechaToAnsiDate(texto){
  var txtfecha, vpartes, i ;
  vpartes = texto.split("/");
  return String(vpartes[2])+String(vpartes[1])+String(vpartes[2]);
}

function validarIntervalData(min,max){
   var fecha, fechaaux;
	fecha = new Date(reverseFecha(min));
	fechaaux = new Date(reverseFecha(max));
	if (fecha.valueOf() > fechaaux.valueOf()) return false;
		else return true;
}
//  End -->


function chkdateddmm(objName) {
//var strDatestyle = "US"; //United States date style
var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Enero";
strMonthArray[1] = "Febrero";
strMonthArray[2] = "Marzo";
strMonthArray[3] = "Abril";
strMonthArray[4] = "Mayo";
strMonthArray[5] = "Junio";
strMonthArray[6] = "Julio";
strMonthArray[7] = "Augosto";
strMonthArray[8] = "Septiembre";
strMonthArray[9] = "Octubre";
strMonthArray[10] = "Noviembre";
strMonthArray[11] = "Diciembre";
strDate = datefield.value;
if (strDate.length < 1) {
	return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 2) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
   }
}

// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(strDay)==true) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(strMonth)==true) {
err = 3;
return false;
   }
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
}
// AQUÍ ES ON ES CONSTRUEIX LA DATA RESULTANT
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday;
}
else {
	if (intday < 10)
		intday = '0' + intday;
	if (intMonth < 10)
		intMonth = '0' + intMonth; 
datefield.value = intday+ "/" + intMonth;
}
return true;
}
//  End -->