String '1/2/2024' was not recognized as a valid DateTime

can any one help to convert the string to date time format
i’m using thsis condition
Datetime.ParseExact(FileDates.Replace(“-”,“/”).Trim,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
But it’s not working

Hi @Krishna_Arjun

Try this:

Datetime.ParseExact(FileDates.Replace("-","/").Trim,"M/d/yyyy",System.Globalization.CultureInfo.InvariantCulture)

Regards

Can you try the following?

Datetime.ParseExact(FileDates.Replace("-","/").Trim,"M/d/yyyy",System.Globalization.CultureInfo.InvariantCulture)

Regards,

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