Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

24 hr Time check?

Back to Forum: Tech Off
  • User profile image
    venkatzeus

    Hi..
    I have a web application, in which the userr enters the time in a textbox. I am trying for 24 hour time format. How to check if the user entered the time is in 00:00:00 to  23:59:59 format? If the user enters 23:60:00, an error message to be popped

  • User profile image
    venkatzeus

    Hi..
     I checked using the substring and i got the result.

    Thank You

  • User profile image
    Yggdrasil

    venkatzeus wrote:
    Hi..
    I have a web application, in which the userr enters the time in a textbox. I am trying for 24 hour time format. How to check if the user entered the time is in 00:00:00 to  23:59:59 format? If the user enters 23:60:00, an error message to be popped


    Rather than do all the string hacking yourself, I'd recommend doing DateTime.TryParse() and see if it works - chances are the DateTime coder spent a lot more time checking for edge cases than you will.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.