日期验证 [英] Date Validations

查看:74
本文介绍了日期验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 您能在文本框中告诉我用于日期格式的javascript验证的代码吗?

坦克
Sampath.

解决方案

其中一个Google搜索结果此处 [ ^ ] Google,以获取更多便捷的方法.


您将要使用正则表达式.确切的表达式取决于您执行的格式,即yyyy-mm-dd,m/d/yy等.我通常使用 http://regexlib.com/ [ ^ ]作为我的资源,但是Google搜索正则表达式日期验证"会出现很多选择.


Google,您会发现它.

您也可以使用 ASP.NET CompareValidator [ 解决方案

One of the googled results here[^] Google for more and easy ways.


You would want to use Regular Expressions. The exact expression depends on what format you are enforcing, ie yyyy-mm-dd, m/d/yy, and so on. I usually use http://regexlib.com/[^] as my resource, but a Google search for "regex date validation" will turn up lots of options.


Google and you will find it.

You may also use ASP.NET CompareValidator[^]. Set the type as date. You will find various examples on the web on how to use it.


这篇关于日期验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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