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

How to Get Complete Month & Day Name From Current DateTime

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

                            Download Coding



Html Coding

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <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" />

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");


First Add The New Web Form -  Add Label & 


Next - Day Button - Doule Click - Add Below Coding

Next - Month,Year Button - Doule Click - Add Below Coding

Next - Run[F5] - The Program -  Select Button Respective Results Display.



Post a Comment