admin管理员组

文章数量:1415664

In my page one asp Textbox to enter the date.

I need to validate the textbox value ( dd-mmm-yyyy format) should be less than or equal to Current Date using Javascript.

validation using javascript when press on enter button.

In my page one asp Textbox to enter the date.

I need to validate the textbox value ( dd-mmm-yyyy format) should be less than or equal to Current Date using Javascript.

validation using javascript when press on enter button.

Share Improve this question edited Feb 9, 2012 at 15:27 Pranay Rana 177k37 gold badges243 silver badges265 bronze badges asked Jun 17, 2010 at 9:56 jiya guptajiya gupta 1091 gold badge2 silver badges8 bronze badges 1
  • Thanks but i want to validate date using javascript. – jiya gupta Commented Jun 17, 2010 at 10:26
Add a ment  | 

1 Answer 1

Reset to default 3
var myDate1= document.form1.Textbox2.value;

  var date  = myDate1.substring(0,2);
  var month = myDate1.substring(3,5);
  var year  = myDate1.substring(6,10);

  var myDate= new Date(year,month-1,date);

var today = new Date();

if (myDate>today)
  {
  alert("Today is before ");
  }
else
  {
  alert("Today is after ");
  }

本文标签: jqueryHow to validate one date from current date in javascriptStack Overflow