Hi, anyone can advice me?
Im trying to convert the string ‘ENE/15/2022’ to datetime, but as you can see the month is in spanish. I already tried this: Convert.ToDateTime(A.Split("-"c)(0).Trim,CultureInfo.GetCultureInfo(“es-ES”)), and also with Parse and ParseExact methods but it still dont work.
Hello @Sudharsan_Ka thanks for your answer, I tried with that method but still getting the same error, I checked the imports and i have the system.globalization ¿There is another one I need to run the activity correctly?
hello @Gokul_Jayakumar and @jack.chan, I also tried with the method you write with just copy and paste that but I am still getting the error as in the case of the code from Sudharsan_Ka. Can you help to do it with that method? I dont know which dependency or error I am missing.
This is the log message:
Source: Write Line
Message: String ‘ENE/15/2022’ was not recognized as a valid DateTime.
Exception Type: System.FormatException
System.FormatException: String ‘ENE/15/2022’ was not recognized as a valid DateTime. at System.DateTimeParse.ParseExactMultiple(ReadOnlySpan1 s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style) at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) at Namespace_30cf.Main_Expressions.Main_Expressions_TypedDataContext2_ForReadOnly.__Expr3Get() at Namespace_30cf.Main_Expressions.Main_Expressions_TypedDataContext2_ForReadOnly.ValueType___Expr3Get() at Namespace_30cf.Main_Expressions.InvokeExpression(Int32 expressionId, IList1 locations, ActivityContext activityContext)
at System.Activities.Expressions.CompiledExpressionInvoker.InvokeExpression(ActivityContext activityContext)
at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)