File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Validating Time Format (HH:MM:SS)
Joined: Nov 27, 2005
Sep 01, 2006 01:01:00
I m trying to validate Time which is HH:MM:SS format. But not able to do it.
Suppose input = 34:67:78
pat = " ( [0-1]+[0-9]+) |([0-3]+) : ( [0-5]+[0-9]+) : ([0-5]+[0-9]+ ) ";
p = Pattern.compile(pat);
Its validating this input...
Plzz tell me wat is wrong in this ???
Joined: Oct 20, 2005
Sep 01, 2006 01:42:00
The + after the  is making one or more cases. Remove + it will work.
More inputs are welcome.
I agree. Here's the link:
subject: Validating Time Format (HH:MM:SS)
problem in getting date and time in textbox
time comparison between given periods
how to get the last modified time of a text file
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014