如何将输入日期与当前月份进行比较? [英] How can I compare my input date with the current month?
本文介绍了如何将输入日期与当前月份进行比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个asp:TextBox,用户在其中插入日期。现在我想将日期的月份与当前月份进行比较,如果它比较旧,那么当前月份会显示一个文本。
Hi,
I have a asp:TextBox, in which the user inserts a date. Now I like to compare the month of the date with my current month and if it's older then the current month show a text.
function InsertProjectCharging() {
var date = $('#<%=txtDateFrom%>').val();
if (ParseInt(date.substring(3, 2)) < (now.getMonth() + 1)) $('.dateValidation').show();
else {
......
}
}
非常好,如果有人可以帮助我的话!
我尝试了什么:
我也用Number(月)代替parseInt
Would be really nice, if someone could help me!
What I have tried:
I also tried it with Number(month) instead of parseInt
推荐答案
(' #<%= txtDateFrom%>')。val();
if (ParseInt(date.substring( 3 , 2 ))<(now.getMonth()+ 1 ))
('#<%=txtDateFrom%>').val(); if (ParseInt(date.substring(3, 2)) < (now.getMonth() + 1))
(' .dateValidation')。show();
其他 {
......
}
}
('.dateValidation').show(); else { ...... } }
非常好,如果有人可以帮助我的话!
我尝试了什么:
我也尝试用Number(月)而不是parseInt
Would be really nice, if someone could help me!
What I have tried:
I also tried it with Number(month) instead of parseInt
用它们作为日期
Work with them as dates
var now = new Date();
var date =
这篇关于如何将输入日期与当前月份进行比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文