Simplemente estaba tratando de usar la DateTimeestructura para transformar un número entero entre 1 y 12 en un nombre de mes abreviado.
Esto es lo que probé:
DateTime getMonth = DateTime.ParseExact(Month.ToString(),
"M", CultureInfo.CurrentCulture);
return getMonth.ToString("MMM");
Sin embargo, obtengo un FormatExceptionen la primera línea porque la cadena no es válida DateTime. ¿Puede alguien decirme cómo hacer esto?

GetAbbreviatedMonthName()parece apropiado.int month = DateTime.ParseExact(MonthNameValue, "MMMM", CultureInfo.CurrentCulture ).Monthvar monthIndex = 1; return month = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(monthIndex);Puedes probar este también
fuente
En su lugar, puedes hacer algo como esto.
return new DateTime(2010, Month, 1).ToString("MMM");fuente
CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName( Convert.ToInt32(e.Row.Cells[7].Text.Substring(3,2))).Substring(0,3) + "-" + Convert.ToDateTime(e.Row.Cells[7].Text).ToString("yyyy");fuente
eviene ?!