I want to verify that the date entered is in yyyy/mm/dd format. If by mistake user enters in dd/mm/yyyy format, it must automatically convert to yyyy/mm/dd using Javascript function.
Edited:
function CheckDateFormat()
{
EnteredText = document.getElementById('LDate').value;
LengthOfText = EnteredText.length;
Status = true;
for(i=0;i<=LengthOfText;i++)
{
currentChar = EnteredText.substr(i,1);
if (currentChar == '/' && (i != 5 || i != 8))
{
alert("Invalid date format");
document.getElementById('LDate').focus;
status = false;
}
if (status == false)
break;
}
}