Inconsistent Error Recognizing String as Valid DateTime


I have a process that runs every night, and sometimes it will repeat multiple times in one night. However, approximately every two weeks, one of my Assign activities will error out saying “String was not recognized as valid DateTime.”

Below is a screenshot of the field I am pulling the date from. I need to pull this date off the screen, remove the forward slashes (using a Replace activity), add one date (using Assign-this is the part that errors), and then use that new date to reenter into the window.

In my Assign activity, I am using the following. This is the activity that causes the error.


I am not familiar with VB, and I got this code from a different topic on the forum. I am not sure why most days this works without error but then it will fail randomly.

Any help you can provide would be greatly appreciated.

Thank you,

1 Like

@Palaniyappan Would you be able to provide some insight on this? I took the original code for my Assign activity from your post on Convert a string to date.

I am starting with a string, turning it into a date so I can add a day, then converting back to a string in MMddyy format. Should I split this into two activities so that it consistently recognizes the value?

Thank you.

1 Like

No worries,

we need to validate the date format we get from variable LR in this below expression

and are we sure we get always the same date format MMddyy or is it ddMMyy

Cheers @jdahlinger

I am using a Get Text activity to read the date from my application and then using a Replace activity to remove the / from the date. That is the value that is being used as LR. Please see screenshot in the original post for reference. I am not sure why it would give me the correct value for two weeks straight and then error out on the next day.