Sequence3.xaml (31.1 KB)
While entering the date (34/34/2021) that does not exist getting an error message instead of going in else loop.
Took input from user in “dd/MM/yyyy” format and Converting it into “MM/dd/yyyy” format…
Sequence3.xaml (31.1 KB)
While entering the date (34/34/2021) that does not exist getting an error message instead of going in else loop.
Took input from user in “dd/MM/yyyy” format and Converting it into “MM/dd/yyyy” format…
Hi,
Can you try to use the following condition in IF activity whether input string is valid datetime string, in advance?
DateTime.TryParseExact(journeyDate,"dd/MM/yyyy",Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None,New DateTime)
or If use InvokeMethod activity, we can also get validation result as boolean and parsed result as datetime using following expression.
ret = DateTime.TryParseExact(journeyDate,"dd/MM/yyyy",Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None,resultDateTime)
Regards,
34/34/2021 is not a valid date
last month in year is 12
latest day in a month is 31
so it is reasonable that the exception states that this date is not conatined in a calendar
we can handle this with tryParseExact as mentioned by Yoichi
Also have a look here on how to handle multiple dateformats (TryParseExact, ParseExcact)
Thankyou
Ya ,so i was expecting it to go in else condition.
Thankyou It worked
Hi,
FYI, if you want to use Invoke Method activity, the following will help you.
Sequence3.xaml (36.5 KB)
Regards,
I am new to UIPath and would love to learn new ways of coding. For sure will use this in my workflow. Thank you so much.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.