C#DateTime解析短字符串("MMMyy")

JNM*_*JNM 5 .net c# datetime parsing c#-4.0

我有一个包含日期的字符串,格式为"MMMyy".怎么可能这样做?
样品:

string date = "MAY09";
DateTime a = DateTime.Parse("MAY09"); //Gives "2012.05.09 00:00:00"
DateTime b = DateTime.ParseExact("MAY09", "MMMyy", null); //Gives error
DateTime c = Convert.ToDateTime("MAY09"); //Gives "2012.05.09 00:00:00"

I need "2009-05-01"
Run Code Online (Sandbox Code Playgroud)

Kir*_*huk 8

在3指定固定区域性第三参数,而不是null:

DateTime b = DateTime.ParseExact("MAY09", "MMMyy", CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud)