AM using regular expression to check the given time in the format HH:MM
eg.,
var re = /^\s*([01]?\d|2[0-3]):?([0-5]\d)\s*$/;
if ((m = s.match(re))) {
result = (m[1].length == 2 ? "" : "0") + m[1] + ":" + m[2];
}
Which works fine.But i want to convert and display the given number to the given regular expression format .Can any one help me in finding solution for this.
Example :
if we enter 1 it has to convert as 01:00 or 1.0 as 01:00
Or is there any other way to convert other than regular expression
For example:
This converts all possible numeric inputs to the HH:MM format