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 :: c# 
Csharp :: unity on inspector change 
Csharp :: c# get value from textbox 
Csharp :: c# messagebox yes no "wpf" 
Csharp :: c# get offset from timezone 
Csharp :: change sprite of a sprite unity 
Csharp :: c# linq select from object list 
Csharp :: c# remove special characters from string 
Csharp :: c# listbox delete selected items 
Csharp :: how set function when props update in vue 
Csharp :: remove comma from string c# 
Csharp :: c# do while loop 
Csharp :: c# string array contains 
Csharp :: instantiate list c# 
Csharp :: c# make request to rest api 
Csharp :: how to make panel scrollable c# 
Csharp :: c# read file 
Csharp :: C# decimal with two places store as string with two places 
Csharp :: unity reverse string 
Csharp :: c# array to string 
Csharp :: c# csv read write 
Csharp :: how to add to a list c# 
Csharp :: nested dictionary c# 
Csharp :: switch case in c# with multiple values 
Csharp :: unity ui movement 
Csharp :: c# add multiple items to list 
Csharp :: c# main 
Csharp :: c# list audio devices 
Csharp :: count number of properties on an object C# 
Csharp :: xmldocument to c# object 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =