I need to check under if condition where it iterates within an excel sheet row by row by checking a particular column content which has a string in dd/MM/yyyy format.
Can anyone please help?
I need to check under if condition where it iterates within an excel sheet row by row by checking a particular column content which has a string in dd/MM/yyyy format.
Can anyone please help?
Hi @N_Anandha_Krishnan - Can you check the below one, with IF activity
DateTime.TryParseExact(StrDateTime,“dd/MM/yyyy”,cultureInfo.InvariantCulture,DateTimeStyles.None)
in general we can check wit a regex or the datetime.TryParseExact method as mentioned by Usha
( for the result/output argument on the end of the method signature we can also use nothing as we are not interested on it)
DateTime.TryParseExact(YourStringVar,YourFormatStringOrFromatStringArray,YourCultureInfo,DateTimeStyles.None, nothing)
let us know on what is needed
Hi @N_Anandha_Krishnan ,
You can try the below expression in an if condition inside the for each row in datatable, it will return a boolean value if date is\not present.
system.Text.RegularExpressions.Regex.IsMatch(CurrentRow("ColumnName").ToString,"\d{2}\/\d{2}\/\d{4}")
Regards,
Thanks for the immediate response but unfortunately it didn’t work.
Error message being displayed is “Overload resolution failed”
@N_Anandha_Krishnan - Can you please refer to below link. Let us know if it didn’t help
Validate date entered by user in Dd-mm-yyyy Format - Help - UiPath Community Forum
could be cause by
so check that the last method argument is e.g. nothing as mentioned here
Hello,
You can use a IsMatch activity with Regex for date in your case regex expression will be
^(3[01]|[12][0-9]|0[1-9])/(1[0-2]|0[1-9])/[0-9]{4}
You can check the .xaml file for reference.
Main.xaml (8.9 KB)
Regards
Can you try this one-
If DateTime.TryParseExact(row.Item(“ColumnName”).ToString(), “dd/MM/yyyy”, CultureInfo.InvariantCulture, DateTimeStyles.None, out dtDate)
Thanks!!