How to find month name in c#

May 10, 2014 0 Comments

Using the CultureInfo, you can get calendar information such as date, current month, current date etc. In this program we will get month name. Using the parameterized GetMonthName ( ) method , you can  retrieve month information.
<form id="form1" runat="server">
        <asp:Button ID="Button1"
          Width="69px" />  
        <asp:Label ID="Label1"
Code Behind
 protected void Button1_Click(object sender, EventArgs e)
            DateTime today = DateTime.Today;
            String Todaymonth = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(today.Month);
            String month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(2);
            Label1.Text = "Today : " + today.ToLongDateString();
            Label1.Text += "<br /><br />today month Name= ";
            Label1.Text += Todaymonth;
            Label1.Text += "<br /><br /> [2] number month= ";
            Label1.Text += month;

Code Generate the following output
How to find month name in c#

Jackrin Reacher

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google