Nicole Phillips Nicole Phillips - 1 month ago 7
C# Question

Parse a String date like this: March 03/12/2016 to just 03/12/2016

I need to do a simple parse the strip out the actual word March (or whatever month it is) from a data saved to a string like this: "March 03/12/2016".

The ending results need to be a string such as: "03/12/2016".

I have been looking through date time formatters and I am not finding a simple method to strip out a month. I was thinking of just cutting the string down to count 11 characters from right to left and then just trimming out the rest but I feel like that is sloppy and there is probably a date format option out there that I'm just not finding.

Any Suggestions?

Answer

Another approach:

string result = input.Split(' ')[1];
Comments