文本框日期与今天日期的比较 [英] Comparison of Text box date with today date

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

问题描述

您好我在文本框20/03/2012的aspx页面中有日期并且在javascript中的今天日期在一个变量dmy = 09/03/2013现在我想检查今天日期的文本框日期,月,年(dmy变量),如果文本框日期是从今天起的过去日期,则需要返回错误可以帮助我javascript中的代码

Hi i am having the Date in the aspx page of text box 20/03/2012 and having the today date in one variable dmy=09/03/2013 in javascript now i want to check the text box date with today date,month,year(dmy variable)and need to return error if the text box date is past date from today date can u help me the code in javascript

推荐答案

首先总之,我不建议使用文本框作为日期。您可以更好地使用ASP.NET的 DateTimePicker

DateTimePicker Web控件 [ ^ ]。



其他所有内容都在这里: http://msdn.microsoft.com/en-us/library/system.datetime.aspx [ ^ ]。



也许,你可能只需要一个提示:为了比较,您可以简单地使用运算符''=='',''!='',''> ='',''< ='',''>''和''' <''。



-SA
First of all, I would not recommend to use text box for date. You can better use DateTimePicker for ASP.NET:
DateTimePicker Web Control[^].

Everything else is here: http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].

Perhaps, you may need only one hint: for comparison, you can simply use the operators ''=='', ''!='', ''>='', ''<='', ''>'', and ''<''.

—SA


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

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