Convert input string to mm/dd/yyyy

Typical input formats are 10 Dec 2019, 10 DEC 2019, 10 December 2019, 10 DECEMBER 2019, 10 jun 2019, 10 june 2019

i want to convert them to

12/10/2019, 12/10/2019 , 12/10/2019, 12/10/2019, 6/10/2019, 6/10/2019

Try this @Gaurav_Bahuguna

cDate(" your input date format").toString(“expected date format”)

DateTimeParseMultipleFormats.xaml (6.6 KB)

Try this.!

Thanks!

Hey @Gaurav_Bahuguna

output_variable = DateTime.Parse(input_variable).ToShortDateString

thanks!

@Gaurav_Bahuguna

It is very easy!!!

Follow the below steps:-

string Array formats = {“dd MMM yyyy”,“dd MMMM yyyy”}

string Array inputSamples = {“10 Dec 2019”, “10 DEC 2019”, “10 December 2019”, “10 DECEMBER 2019”, “10 jun 2019”, “10 june 2019”}

for each item in (inputSamples)
{
DateTime OutPutSamples = Date.ParseExact(item.ToLower,formats,System.Globalization.DateTimeFormatInfo.InvariantInfo, Globalization.DateTimeStyles.None)

message box → OutPutSamples
}

I tested it from my side.

Please help yourself by using this. Mark this as solution if it helps you.

Thanks and Regards,
@hacky

1 Like

Try this

Convert.ToDateTime(“10 Dec 2019”).ToString(“MM/dd/yyyy”)

Thanks

@Gaurav_Bahuguna

Did you tried any of the below mentioned solutions ? If yes then are you able to resolve this query ?