An application that you are implementing requires multiple date formats to be transformed into one common date format.

Implement the function ChangeDateFormat which accepts a list of strings, representing dates, and returns a new list with each date in the format YYYYMMDD. All incoming dates will be valid dates, but only those in one of the following formats: YYYY/MM/DD, DD/MM/YYYY, and MM-DD-YYYY should be included in the returned list, where YYYY, MM, and DD are numbers representing year, month, and day.

For example, ChangeDateFormat(new List {"2010/03/30","15/12/2016", "11-15-2012", "20130720"}); should return the list {"20100330", "20161215", "20121115"}.

using System;
using System.Collections.Generic;

public class DateTransform
{
public static List< string> ChangeDateFormat(List< string> dates)
{
throw new InvalidOperationException("Waiting to be implemented.");
}

public static void Main(string[] args)
{
var input = new List< string> {"2010/03/30", "15/12/2016", "11-15-2012", "20130720"};
DateTransform.ChangeDateFormat(input).ForEach(Console.WriteLine);
}
}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.