Friday, 20 February 2015

How to Get Complete Month & Day Name From Current DateTime Using Asp.Net C#

No comments    
categories: , , ,
How to Get Complete Month & Day Name From Current DateTime


Get Current  Day & Month Full Name From DateTime  Using in C# .


                              Download Coding

                                                Download

                                     DEMO


Html Coding

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
   
        <asp:Label ID="lblCalender" runat="server" ForeColor="#CC3300"></asp:Label>
  
        <asp:Button ID="btnDate" runat="server" OnClick="Button1_Click" Text="Date" />

        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Month" />

        <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Year" />
       
   
    </div>
    </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 DateGet : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
  
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        // Get Full  Name Of Current Day
       
        lblCalender.Text = DateTime.Now.ToString("dddd");

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
     
        // Get Full Name of Current Month

        lblCalender.Text = DateTime.Now.ToString("MMMM");


    }
    protected void Button3_Click(object sender, EventArgs e)
    {


        // Get Current year

        lblCalender.Text = DateTime.Now.ToString("yyyy");

    }
}


















0 comments:

Post a Comment