If Condition: String was not recognized as a valid DateTime

Hi, I am having an issue with my If Activity condition. Its having a “String was not recognized as a valid DateTime” error. I’m not sure what went wrong in the condition I set.

@Zorina25
Welcome to the forum

Feel free to share with more value details / samples and explore within debugging:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

We do feel that Left(…, 16) can return 16 chars, but the format dd/MMM/yyyy is only 11 chars long

Hi,

I tried adding a message box to get the output of the item.Headers(“Date”). Here’s the result.

image

date from message box is not in the format of dd/MMM/yyyy

So the exception is valid.

Kindly note:
grafik

First 2 samples are demonstating Conversion Options
Third sample is about showing the -0400 ignoration

We can see the baselined time part. On midnight borders it can result to a different date. So the cutoff can maybe risky
grafik

When the handling of multiple formats is needed we can do:

taken from:

Hi

Try to mention like this

Datetime.ParaeExact(item.Headers(“Date”).ToString.Trim, “ddd, dd MMM yyyy HH:mm:ss zzz”, System.Globalisation.CultureInfo.InvariantCulture).ToShortDateString

For more info

Hope this helps
Cheers @Zorina25

This is the variable MailMessage its getting. I think I’m doing the configurations wrong.
image|246x48

refering to your image
image

grafik

But with the hint of the timezone US/Eastern maybe also a baselining is recommended

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