0

hello..
actually i am entering starting date. and also giving period in digits.for example 2yrs. to day date 22/01/2010. after 2years that date will 22/01/2012.

how to find end date using javascript.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by muralikalpana
-1

hello..
actually i am entering starting date. and also giving period in digits.for example 2yrs. to day date 22/01/2010. after 2years that date will 22/01/2012.

how to find end date using javascript.

i found script but display date only. how to display date only.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
Date.prototype.addMonths = function (n) {
var day = this.getDate();
this.setMonth(this.getMonth() + n);
if (this.getDate() < day) {
this.setDate(1);
this.setDate(this.getDate() - 1);

}
return this;
}
var d = new Date("jan 22, 2010");
alert(d.addMonths(24));
</script>
</head>

<body>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.