I have multiple fields that I will want to convert to a specific date format but I don't want to have to retype all of the code over and over so I'd like to create a Method that I can pass the field into which would convert it.
Right now I have
string strDate = line.Substring(296,8);
DateTime MyDate = DateTime.ParseExact(strDate,"yyyyMMdd",CultureInfo.CurrentCulture);
polDS.Policy.DEPARTUREDATE = MyDate.ToString("MM/dd/yyyy");
Is there a way to create a method that I could pass in strDate so that it's converted? That way I can just call the method for each substring that I need converted.