How to get after 30 days date from current date using JavaScript

Many time , we need to show after (next date) or before(previous) date from the current date .In the previous  article we have how to get before  30-days date from current date and now we are going to show after  date from current date




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Get Date .aspx.cs" Inherits="Get_Date_" %>

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">

        function getdates() {

            var today = new Date()

            var afterdate = new Date();

            afterdate.setDate(afterdate.getDate() + 30)

            document.getElementById('lblCurrentDate').innerHTML = today;

            document.getElementById('lblAfterDate').innerHTML = afterdate;

        } 
    </script>

</head>
<body onload="getdates()">
    <div>
        <b>Current Date:</b>
        <label id="lblCurrentDate" />
    </div>
    <br>
    <div>
        <b>after 30 days  </b>
        <label id="lblAfterDate" />
    </div>
</body>
</html>


OUT-PUT:-





How to get after 30 days date from current date using JavaScript How to get after 30 days date from current date using JavaScript Reviewed by NEERAJ SRIVASTAVA on 11:02:00 AM Rating: 5

No comments:

Powered by Blogger.