Uipath string to date conversion returns date as well as time

I have a string 23/10/2023

which i want to be converted to 10/23/2023 in date format.

I tried doing it.
Convert.ToDateTime(Datetime.ParseExact(newstring,“dd-MM-yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”))
but it returned 23/10/2023 00:00:00
I just want 10/23/2023


Where are you getting this format? in excel?

if so you need to format the excel cells properly…nothing to change in the conversion…please use format cells activity



Use this Linq

dateString = String.Join(“/”, dateString.Split(‘/’).OrderByDescending(s => DateTime.ParseExact(s, “dd”, CultureInfo.InvariantCulture)).ToArray())

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