I suggest voting for both possible formats and then analyzing the votes cast:
// collect all the datetime values in the Excel sheet(s)
String[] data = new String[] { "01/02/2000", "25/08/2007", "09/10/2010" };
DateTime dt;
// then analyze them:
int votesForDayMonth = data
.Count(item => DateTime.TryParseExact(item,
"dd/MM/yyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.AssumeLocal,
out dt));
int votesForMonthDay = data
.Count(item => DateTime.TryParseExact(item,
"MM/dd/yyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.AssumeLocal,
out dt));
if (votesForDayMonth == votesForMonthDay) {
// Ambiguity, unlucky you
}
else if (votesForDayMonth >= data.Length) {
// dd/MM/yyyy order: all data can be parsed as dd/MM/yyyy but not as MM/dd/yyyy
}
else if (votesForMonthDay >= data.Length) {
// MM/dd/yyyy order: all data can be parsed as MM/dd/yyyy but not as dd/MM/yyyy
}
else if (votesForDayMonth > votesForMonthDay) {
// probably dd/MM/yyyy order
}
else {
// probably MM/dd/yyyy order
}
In many practical cases when you have enough clear data you can find out the format. In the code above it's "dd/MM/yyyy order"
mmstands for minute useMM