Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Time Validation Help

    I have 2 fields; start time and end time. Is there a way to validate that they enter the times in the correct format? Ex. 12:00

    Here is the basic code:
    Start Time: <input type="text" name="startTime"> (HH:MM format)
    End Time: <input type="text" name="endTime"> (HH:MM format)


    I found the link below which is kind of what I'm looking for, but it has alot of extra stuff that I don't need. I just want to validate the hour and minute.
    http://javascript.internet.com/forms/val-time.html

  • #2
    Banned
    Join Date
    Oct 2005
    Location
    I'm in GMT -5
    Posts
    314
    Thanks
    0
    Thanked 1 Time in 1 Post
    I want, I want, I want....

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    725
    Thanks
    35
    Thanked 132 Times in 123 Posts
    var rx= /^([1-9]|(11)|(12)) *\: *[0-5][0-9] *$/;
    rx.test(startTime)

  • #4
    New Coder
    Join Date
    Apr 2003
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks mrhoo I will see if I can make that work. You want what Ancora?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •