Conversion of a date extracted from string which dont have a specific format to yyyy-MM-dd format

Hello , i have a date extracted from a text which format is not specified it may be dd-MM-yy or dd/Mm/yyyy or another format, i need to convert it to yyyy-MM-dd stored in a string variable , i tried CDate(MyDateString,“yyyy-MM-dd”).ToString but it didn’t work. Any help please ?

Hi @Deep_HML

You need to give like

DateTime.ParseExact(your date string,{“dd-MM-yy”,” dd/Mm/yyyy”,”any other formats”},System.Globalization.Cultureinfo. InvariantCulture,System.Globalization.DateTimeStyles.None).ToString(“yyyy-MM-dd”)

You can add the any date format inside double quotes and seperate it with ,

After copying the above expression kindly remove all double quotes and replace it manually

Regards
Sudharsan

Cross Reference as introdiced already there:

Hello @Deep_HML

You can use Modify Date Activity to achieve the same.

How to Modify Date in UiPath? Modify Date activity explained with demo

Thanks

@Deep_HML

Try with this expression

CDate(MyDateString).tostring(“yyyy-MM-dd”)

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