仅验证asp.net中的时间 [英] validating only time in asp.net
本文介绍了仅验证asp.net中的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有24小时格式的时间,例如
11:25和14:24等.现在,我必须在文本框中验证这些输入值.
请帮助我进行验证.
谢谢你
Mohd Wasif
Hi All,
I have time in 24 hours format like
11:25 and 14:24 etc .Now I have to validate these input values in textboxes.
Please help me how to validate it.
Thanking You
Mohd Wasif
推荐答案
查看此链接
http://www.mkyong .com/regular-expressions/how-to-validate-time-in-24-hours-format-with-regular-expression/ [ http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=4&categoryId=5 [^ ]
see this link
http://www.mkyong.com/regular-expressions/how-to-validate-time-in-24-hours-format-with-regular-expression/[^]
http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=4&categoryId=5[^]
其中一种方法是使用正则表达式.
试试:
One of the ways would be to use Regular expressions.
Try:
use regex: [0-2][0-9]\:[0-6][0-9]\:[0-5][0-9]
use regex: ([01]?[0-9]|2[0-3]):[0-5][0-9]
您可以根据需要在JavaScript或代码隐藏中使用它.
看起来 ^ ]了解更多.
You can use it in JavaScript or code-behind as per your need.
Look here[^] for more.
这篇关于仅验证asp.net中的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文