如何将输入日期与当前月份进行比较?

如何将输入日期与当前月份进行比较?

问题描述:





我有一个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 =