hi all,
i need a code for date comparision,my requirement is first we have to enter start date and when we enter end date it should check whether the date is greater than the start date or not if it is greater only it should alow otherwise it shoud alert........

for ex : if i entered start date as 20/07/2008
it shoudl accept the next dates like 21/07/2008 or later
but should not accept 19/07/2008
i hope u got my point.............

so pls. help me thanx in adv

i understand what u need to do, but what have u done, can we look at some code that u have done.

var now = new Date(); 
      var today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); 
      var user_dt=document.getElementById("ctl00_ContentPlaceHolder1_txtcanndate").value;
      var dd=parseInt(user_dt.substring(0,2),10);
      var mon=parseInt(user_dt.substring(3,5),10);
      var yr=parseInt(user_dt.substring(6,10),10);
      var userDate = new Date(yr,mon,dd); // Get user date in mm/dd/yyyy format
    if(today.getDate() > userDate.getDate())
       alert("Announcement date is less than Today's");
	   return false;

u can change u r code based on the above code

thnx for ur reply , i did my code like this..........

i got the output.............

<title>Compare Dates</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<Script Language=Javascript>
function CompareDates()
   var str1  = document.getElementById("fromdate").value;
   var str2  = document.getElementById("todate").value;
   var dt1   = parseInt(str1.substring(0,2),10);
   var mon1  = parseInt(str1.substring(3,5),10);
   var yr1   = parseInt(str1.substring(6,10),10);
   var dt2   = parseInt(str2.substring(0,2),10);
   var mon2  = parseInt(str2.substring(3,5),10);
   var yr2   = parseInt(str2.substring(6,10),10);
   var date1 = new Date(yr1, mon1, dt1);
   var date2 = new Date(yr2, mon2, dt2);

   if(date2 < date1)
      alert("To date cannot be greater than from date");
      return false;
      alert("Submitting ...");


<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<input type="text" name="fromdate" id="fromdate" value="20/10/2005">
<input type="text" name="todate" id="todate" value="19/10/2005">
<input type="button" value="compare dates" onclick="CompareDates()">