How to convert string to date format

HI @HeartCatcher

How about this expression?

DateTime.ParseExact("10/18/2022 00:00:00",{"MM/dd/yyyy hh:mm:ss","MM/dd/yyyy HH:mm:ss","dd/MM/yyyy hh:mm:ss","dd/MM/yyyy","MM/dd/yyyy"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy")

Regards
Gokul