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# return list 
Csharp :: dictionary to string c# 
Csharp :: what is data encapsulation c# 
Csharp :: C# datetime.now to string only numbers 
Csharp :: how to make teleporter in unity 
Csharp :: key press up unity 
Csharp :: changing euler angles unity 
Csharp :: data annotation c# name 
Csharp :: how consider the first caracter in Split c# 
Csharp :: How to search for a string from readline in c# 
Csharp :: abril modal boostrap 
Csharp :: c# start file 
Csharp :: start the terminal from c# 
Csharp :: unity how to stop the game 
Csharp :: c# remove from list in foreach 
Csharp :: c# streamwriter 
Csharp :: if char is upper csharp 
Csharp :: how to add item to listbox in c# 
Csharp :: c sharp list length 
Csharp :: how to create a list in c# unity 
Csharp :: https port 
Csharp :: button size xamarin 
Csharp :: asking for user input integer c# 
Csharp :: List string to file C# 
Csharp :: reverse string c# 
Csharp :: c# array 
Csharp :: unity camera follow player 3d smooth 
Csharp :: c# read file line by line 
Csharp :: c# mathf.ceiling 
Csharp :: get description from enum c# 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =