Assign: String '10/08/2023 ' was not recognized as a valid DateTime

I’m trying to convert a string to a date, but I get this error

This is my convert assing: Convert.ToDateTime(Datetime.ParseExact(ShortDate,“dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd.MM.yyyy”))

@gustavo.souza

Datetime.ParseExact(ShortDate,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd.MM.yyyy”)

1 Like

The problem was that my date was coming with a space "08/10/2023 "

I solved it by removing the space using modify text

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.