"String was not recognized as a valid datetime"

hi there,

I am facing an issue when trying to convert a string value from an excel file to datetime value to be used when running a queue of orders in Orchestrator.
I’m getting the following error:

Info : “Execution error : System.FormatException: String was not recognized as a valid DateTime.\r\n at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)\r\n at lambda_method(Closure , ActivityContext )\r\n at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context)\r\n at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)\r\n at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity)\r\n at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)\r\n at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)\r\n at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)\r\n at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)\r\n at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)”

I’ve also attached the try catch used for this specific action.

Can anyone offer a suggestion on how to bypass this issue?
Much appreciated :slight_smile:

project.json (298 Bytes)
Main.xaml (10.3 KB)

@JohnnyRR Try this

                             assign   indicarData = indicarDataDate.ToString("dd-MM-yyyy HH:mm:ss")

hi,

I’ve tried this and now I’m getting this error :frowning: - not sure if it’s related to the previous issue anymore

Info : “Execution error : UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: —> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector: \r\n at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)\r\n at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector)\r\n — End of inner exception stack trace —\r\n at UiPath.Core.Activities.TaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)”