Hi @SorenB
You can use a wildcard-style format in ParseExact by handling multiple possible date formats using DateTime.TryParseExact or by defining several formats. You can try something like this:
formats = {“d-M-yyyy”, “dd-MM-yyyy”, “d-MM-yyyy”}
If DateTime.TryParseExact(dateStr, formats, New System.Globalization.CultureInfo(“da-DK”), System.Globalization.DateTimeStyles.None, result) Then
Console.WriteLine(result.ToString(“dd-MM-yyyy”))
Make sure that result variable type is DateTime
Hope this helps.