Results 1 to 3 of 3
  1. #1
    Alairmon is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default validate time input format

    hi,

    i need to have a validation if the input is valid and using hh:mm time format?

    thanks,

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    6

    Default

    And what input is valid for your mind?Can you ask clearer the question and please show what you have done,any lines of code.

  3. #3
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    Here's an algo( if you didn't try it yet )

    given unknown value, and expecting there is a colon(:) on that value,

    try to split the data(preferably String) through colon(:)
    Check if returned String array has length of 2 (0 - 1 are despaired)

    you may use the try/catch to validate the data by converting the strings into an integer

    once they are valid integers, try to check if the first datum is greater than 23(max time is 23:59) and if the second datum is greater than 59,

    if both comparison are satisfied, then play with those data....
    freedom exists in the world of ideas

Similar Threads

  1. How to validate date using SampleDateFormat
    By Java Tip in forum java.text
    Replies: 0
    Last Post: 04-04-2008, 02:38 PM
  2. repaint validate doLayout
    By Gajesh Tripathi in forum AWT / Swing
    Replies: 1
    Last Post: 10-27-2007, 06:53 PM
  3. How to validate date using SampleDateFormat
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:31 PM
  4. validate hex character
    By paul in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 09:08 PM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

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