Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get month number from name

int month = DateTime.ParseExact(MonthNameStr, "MMMM", CultureInfo.CurrentCulture ).Month
Comment

getname of month from date c#

using System;
using System.Globalization;

class Program
{
    static void Main()
    {

        Console.WriteLine(DateTime.Now.ToMonthName());
        Console.WriteLine(DateTime.Now.ToShortMonthName());
        Console.Read();
    }
}

static class DateTimeExtensions
{
    public static string ToMonthName(this DateTime dateTime)
    {
        return CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dateTime.Month);
    }

    public static string ToShortMonthName(this DateTime dateTime)
    {
        return CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(dateTime.Month);
    }
}
Comment

c# get month number

string sMonth = DateTime.Now.ToString("MM");
Comment

find month number from date C#

string name = DateTime.ParseExact("01/21/2014", "MM/dd/yyyy", null).ToString("MMMM"); //January
Comment

PREVIOUS NEXT
Code Example
Csharp :: insert new item listview c# 
Csharp :: c# random generator 
Csharp :: unity how to stop the game 
Csharp :: unity get scrollbar value 
Csharp :: enable fullscreen unity code 
Csharp :: mathf.clamp unity 
Csharp :: SAVE FLOAT UNITY 
Csharp :: photon rpc 
Csharp :: unity new Color() 
Csharp :: make invisible unity 
Csharp :: odd or even in c# 
Csharp :: WebClient c# with custom user agent 
Csharp :: loop datagridview c# 
Csharp :: unity point between two positions 
Csharp :: random in unity 
Csharp :: unity rotation 
Csharp :: triangle minimum path sum 
Csharp :: convert array object to int[] c# 
Csharp :: unity keycode for f 
Csharp :: unity transparent object 
Csharp :: blazor onchange event not firing with inputselect 
Csharp :: convert.tostring with datetime string 
Csharp :: visual studio c# color dialog 
Csharp :: unity log warning 
Csharp :: how to convert int to float in c# 
Csharp :: capitalize c# 
Csharp :: o(n*m) 
Csharp :: c# use hashtable check if key exists 
Csharp :: save byte array to file c# 
Csharp :: Throw index out of range C# 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =