If you want to use dates in C# like 20-mar-2009, you have to know the month abbreviation, for en-US these are:

Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080101", "yyyyMMdd", newCultureInfo( "en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080201", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080301", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080401", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080501", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080601", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080701", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080801", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20080901", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20081001", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20081101", "yyyyMMdd", newCultureInfo("en-US", false))));
Console.WriteLine(string.Format("{0:MMM}", DateTime.ParseExact("20081201", "yyyyMMdd", newCultureInfo("en-US", false))));

/*

Result:
    Jan
    Feb
    Mar
    Apr
    May
    Jun
    Jul
    Aug
    Sep
    Oct
    Nov
    Dec

*/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.