I have a string with the month and year, separated by a "/". I need to convert this to a DateTime, but then convert it back to a string (don't ask, it's how the original developer made it). I have seen several examples on how to convert strings to DateTime, but none would work in this instance.
This would return "11/08", I guess it thinks the 10 is the day instead of the year. How can I get this to work in my instance?Code:String date = "11/10"; DateTime dt = Convert.ToDateTime(date); String result = dt.Month + "/" + dt.Year




Reply With Quote