Tuesday, September 14, 2010

Current date validation in javascript

Current date validation in javascript

<script>
var month=9,day=5,year=2012;
var dateNow = new Date();
dateNow=new Date((dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear());
var Date2 = new Date(month+"/"+day+"/"+year);

if (Date2 >= dateNow)
{
  alert('yes');
}
</script>

No comments:

Post a Comment