Getting string not recognized Assign: String was not recognized as a valid DateTime

I have an assign in a workflow that is scraping the date out of excel, in this instance the value is empty, this happens as the bot scrapes data from a table to compare date, sometimes it could have a date, so i have an assign
str_Date_Scrape = row.item(“Column-7”).ToString.Trim.ToUpper + if(String.IsNullOrEmpty(str_Date_Scrape), “”, str_Date_Scrape)

that will display “” in the logs then I need to pass this as an argument to another workflow


in that workflow

i have an assign in_Verity_Date = Convert.ToDateTime(in_Verity_Date).ToString(“MM/dd/yyyy”)

this is where I get the error of Assign: String was not recognized as a valid DateTime. Not sure what to do to fix this issue?

Hey @jeff.shubzda

This is due to the empty string getting passed.

Just don’t do the above if that is empty.

Thanks
#nK

If in_Verity_Date is already a datetime why are you converting it ToString then back to DateTime then back to String? This makes no sense.

Just do In_Verity_Date.ToString(“MM/dd/yyyy”)

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