Get the Current System Date & Split Day,Month,Year Using Asp.Net C#

Get the System Date & Split Day,Month,Year

Get The Current  System Date(DateTime.Now) then Split Date,Month,Year From DataTime Display The Label Using in Asp.Net C#.

             Download Coding
                          Download

                    DEMO



                HTML CODING


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Get the current System Date & Split Day,Month,Year Using Asp.Net C# </title>
</head>
<body>
<form id="form1" runat="server">  
    <asp:Label ID="Label1" ForeColor="Red"  Font-Size="X-Large" runat="server"></asp:Label>  
</form>
</body>

</html>

                C# CODING


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime dt = Convert.ToDateTime(DateTime.Now.ToString());
      Label1.Text ="Month= "+dt.Month.ToString() +"/"+dt.Year.ToString();

        Response.Write("Year= "+dt.Year.ToString());
        Response.Write("Day=" + dt.Day.ToString());

    }
      
}
    

First - Create New WebForm - Add Label From ToolBox - Change Color & Size.





Next - CodeBehind - Add PageLoad  Get DateTime & Split Day,Month,Year 




      



      



0 comments:

Post a Comment