QqNeed standard date format as output & date has to match in the list of dates which has different format

Hi,

I have a scenario where Input of Date format can be anything example MM /dd/yyyy Or M/dd/yyyy Or M/d/yyyy Or MM/d/yyyy & should compare with above any format in the list of dates in a column in the web portal.

Can you please provide a solution for the above.

Hi @Somanath_Somu

can you refer the below thread.

you can simply use, CDate(yourstring).Tostring(yourrequiredDateFormat)

hope it helps!!!

Hi @Somanath_Somu

Try this:

For Each Row in DataTable:
row("DateColumn") = DateTime.ParseExact(row("DateColumn").ToString(), {"MM/dd/yyyy","M/dd/yyyy","M/d/yyyy","MM/d/yyyy"}, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None)

Hope it helps!!

@Somanath_Somu,

First step would be retrieving as it is date from web portal into a string variable. Be it any format (MM /dd/yyyy Or M/dd/yyyy Or M/d/yyyy Or MM/d/yyyy). You can do it using Get Text activity or Table Extraction. Choice is yours.

Next step would be parsing the date extracted in step one.

standardizedDate = DateTime.ParseExact(inputDateString, 
                                       {"MM/dd/yyyy", "M/dd/yyyy", "M/d/yyyy", "MM/d/yyyy"}, 
                                       System.Globalization.CultureInfo.InvariantCulture, 
                                       System.Globalization.DateTimeStyles.None)

Hope this will be helpful!

Thanks,
Ashok :slight_smile:

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