I have a text box where the user enters a date in english format dd/mm/yyyy and when I run the following function
<SCRIPT language="JavaScript">
function AddDays(startdate,inc) {
DaysToAdd=inc;
alert ("startdate"+startdate+" inc "+inc);
var now=new Date(startdate);
alert (now);
var newdate=new Date();
var newtimems=newdate.getTime()+(DaysToAdd*24*60*60*1000);
newdate.setTime(newtimems);
Adddays=newdate.toLocaleString();
alert (Adddays);
}
// End -->
</SCRIPT>
at the line var now=newdate(startdate); the result is american date. ie mm/dd/yyyy
so if the startdate value is 03/11/2003 then the now value is 11/03/2003 if inc =0
can anyone help me as I have no hair left after a violent pulling spree!!
Regards
Mark
ps. the objective of the function is to add a variable inc number of days to the startdate and return the results.
<SCRIPT language="JavaScript">
function AddDays(startdate,inc) {
DaysToAdd=inc;
alert ("startdate"+startdate+" inc "+inc);
var now=new Date(startdate);
alert (now);
var newdate=new Date();
var newtimems=newdate.getTime()+(DaysToAdd*24*60*60*1000);
newdate.setTime(newtimems);
Adddays=newdate.toLocaleString();
alert (Adddays);
}
// End -->
</SCRIPT>
at the line var now=newdate(startdate); the result is american date. ie mm/dd/yyyy
so if the startdate value is 03/11/2003 then the now value is 11/03/2003 if inc =0
can anyone help me as I have no hair left after a violent pulling spree!!
Regards
Mark
ps. the objective of the function is to add a variable inc number of days to the startdate and return the results.