Add 3 months in current month in

 <form id="form1" runat="server">
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Click" BackColor="#99CCFF" />
    <asp:Label ID="Label1" runat="server" BackColor="Yellow"></asp:Label>
Code Behind
 protected void Button1_Click(object sender, EventArgs e)
            DateTime now = DateTime.Now;        
            DateTime after3Months = now.AddMonths(3);
            Label1.Text = "now = " + now.ToLongDateString();
            Label1.Text += "<br /><br />after added 3 months to now= ";
            Label1.Text += after3Months.ToLongDateString();

Code Generate the following output

Add 3 months in current month in


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites