Hi,
Via a site i’m downloading an Excel. I need to convert the datetime to a specific value
First I tested the value using this:
The result is this:
When I try to convert the datetime to another format I get this error:
While I’m using this function:
"formaat: " + DateTime.ParseExact(newEndDateCognos.ToString, new String(){"MM/dd/yyyy hh:mm:ss","MM/d/yyyy hh:mm:ss","MM/dd/yyyy","MM/d/yyyy","yyyy/MM/dd","yyyy/MM/d","yyyy/MM/d hh:mm:ss","yyyy/MM/dd hh:mm:ss", "yyyy-MM-dd","yyyy-MM-d","yyyy-MM-d hh:mm:ss","yyyy-MM-dd hh:mm:ss","d/MM/yyyy","dd/MM/yyyy","d/MM/yyyy hh:mm:ss","dd/MM/yyyy hh:mm:ss", "d-MM-yyyy","dd-MM-yyyy","d-MM-yyyy hh:mm:ss","dd-MM-yyyy hh:mm:ss"}, CultureInfo.CurrentCulture,DateTimeStyles.None).ToString("d/MM/yyyy")
Yes, I need that many options because the downloaded Excel is very unpredictable.
What am I doing wrong?