One of my friend requested me a code of Javascript to validate the time, which is in the format of 00:00 (24 hrs). i written this code. it may useful to someone, so that i posted in this blog
function Validate24Hrs(Time_Field) {
RegEx = "\([0-2][0-9]):([0-5][0-9])$";
Err_Msg = "";
{
if (Regs = Time_Field.value.match(RegEx)) {
if ((Regs[1] > 23)) {
Err_Msg = 'Not Matching';
}
}
else {
Err_Msg = 'Not Matching';
}
}
if (Err_Msg != "") {
alert(Err_Msg);
Time_Field.focus();
return false;
}
else {
alert('Matching');
return true;
}
}
if it is useful or face any problem, please leave ur valuable comments here.
Have a Great Day!