Current location: Hot Scripts Forums » Programming Languages » ASP.NET » HELP with time validation


HELP with time validation

Reply
  #1 (permalink)  
Old 12-31-04, 01:03 PM
aplesek aplesek is offline
New Member
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
HELP with time validation

Hello:
I have to validate a time entered into a text box by the user.
i.e.(12:09 am)
Can I use the CompareValidator control? If yes, how do I do this?
If not, what can I use?
thanks,
angel
Reply With Quote
  #2 (permalink)  
Old 01-22-05, 10:03 AM
findyourhope's Avatar
findyourhope findyourhope is offline
Newbie Coder
 
Join Date: Jan 2005
Location: Virginia
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Regular Expression Validator for Time Validation

This will work for validating time for SQL Server format. It is a Regular Expression that you can use in a Regular Expression Validator control.

Quote:
(^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])(\s{0,1})([AM|PM|am|pm]{2,2})$)|(^([0-9]|[1][0-9]|[2][0-3])(\s{0,1})([AM|PM|am|pm]{2,2})$)
__________________
Jennifer Wardwell
Software and Web Developer
Microsoft Certified Professional

FindYourHope.com Online Health Community
NewsWired.net News on Any Topic
DigitalAbstract.net Free Website Templates
Reply With Quote
  #3 (permalink)  
Old 02-16-05, 04:32 AM
igor.kudela igor.kudela is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
or you can just write your own validator , inhert the validator class and override a method not sure what it is called now , in that method you parse out the value by casting the htmlcontrol that holds the value and just compare whether it is a time value
5 lines of code max.
__________________
Igor Kudela
http://netpublisher.fragmentsolutions.com
Affordable CMS solution
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accurately showing different time zones meveskr JavaScript 5 07-20-04 03:57 PM
Limit the form submission according to time bionicsamir PHP 7 05-09-04 11:10 PM
time Alii Script Requests 2 03-20-04 11:31 AM
Reduce the time intensive phases of .Net application development using TierDeveloper3 smars General Advertisements 0 12-02-03 05:15 AM
Showing time is users time zone? Nasimov PHP 1 11-20-03 07:14 AM


All times are GMT -5. The time now is 01:00 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.