Forums
This topic is locked
Difference between two date fields
Posted 25 Jun 2002 21:34:03
1
has voted
25 Jun 2002 21:34:03 Rian Carstens posted:
HiI have 3 fields in a form, "FromDate", "ToDate" and "Quantity".
I have 2 calendars on the page which allows users to easily choose the date they arrive and the date they leave.
I need the other field, "Quantity", to automaticaly be calculated. I need the calculation to work out how long the user is planning to stay.
Here is the code:
<pre id=code><font face=courier size=2 id=code> <form name="tstest" method="post"> <TABLE CELLPADDING="6" CELLSPACING="0" BGCOLOR="#ffffcc" BORDER="0" width="590"> <tr> <td valign="top" align="left" colspan="2"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Arriving to the house <input type="Text" name="FromDate" value="50"> <a href="javascript:show_calendar2('document.tstest.FromDate', document.tstest.FromDate.value);"><img src="bookings/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a> Day - Month - Year</font> </td> </tr> <tr> <td valign="top" align="left" colspan="2"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Departing from the house <input type="Text" name="ToDate" value="100"> <a href="javascript:show_calendar2('document.tstest.ToDate', document.tstest.ToDate.value);"><img src="bookings/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a> Day - Month - Year </font> </td> </tr> <TR> <TD VALIGN="top" align="left" colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Number of nights calculated: <input type="text" name="Quantity" size="2" maxlength="2" value="<%=sum%>"> . Please check this is correct.</font></TD> </TR> </TABLE></form> </font id=code></pre id=code>
Any help would do, thanx.
Rian
hey, I'm still learning!?!