如何查找文本是否为时间格式 [英] How to find if a text is in Time format

查看:92
本文介绍了如何查找文本是否为时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带文本框的表单,用户可以用格式输入时间

hh:mm(例如01:00)


如何我可以控制.Text是一种有效的短时间格式


TIRislaa

解决方案

< blockquote>我认为你可以尝试使用datetime.parse并捕获异常...


Tor Inge Rislaa <至************* @ rislaa.no>在消息中写道

新闻:Qy ****************** @ news4.e.nsc.no ...

我有一个带有文本框的表单,用户可以用格式键入时间
hh:mm(例如01:00)

如何控制.Text是有效的短时间格式

TIRislaa





或...


1.通过javascript创建一个掩码例程(如果在

asp.net中使用)


2找到一个屏蔽的控件。


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!


你可以使用IsDate。


如果ISDate(YourDate)那么


其他

结束如果


I have a form with a textbox where the user can type a time in the format
hh:mm (e.g. 01:00)

How can I control that the .Text is a valid Short Time format

T.I.Rislaa

解决方案

I think you can try a datetime.parse and catch exceptions...

"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:Qy******************@news4.e.nsc.no...

I have a form with a textbox where the user can type a time in the format
hh:mm (e.g. 01:00)

How can I control that the .Text is a valid Short Time format

T.I.Rislaa




or...

1. Create a mask routine via javascript (If this is being used in
asp.net)

2. Find a control that does masking.

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


You can use IsDate.

If ISDate(YourDate) then

else

end if


这篇关于如何查找文本是否为时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆