I am trying to turn a month name string into an integer. From my form I am getting a string value for the month, "march" or "april". I was wondering if there was a way of using a library in order to get a number from 1 to 12 as a representative of the months value something like this:
int monthInDigit = DateTime.ParseExact("march", "MMMM", CultureInfo.CurrentCulture).Month;
this code gives me this error
If not, the other solution I had in mind was for my form to save a integer value instead of the string name which seems to be the easiest solution at the moment. Still I would like to know what you think and if there is a way of doing this.