While converting 9/16/2022 date to 2022.16.9 am getting error

Hi all,

I have date Like Date1 - 9/16/2022 i need to convert this date to 2022.9.16
I used the query like “DateTime.ParseExact(Date1.toString(), (“MM/dd/yyyy”), Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.MM.dd”)” and storing in Date2
Both the variable (Date1 and Date2) in string format
but am getting below error

21.10.4+Branch.master.Sha.8f864e3db4251aecabea63041087de2634460029

Source: Assign

Message: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

Exception Type: System.NotSupportedException

RemoteException wrapping System.NotSupportedException: Expression Activity type 'VisualBasicValue1' requires compilation in order to run. Please ensure that the workflow has been compiled. 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, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hi @BNK,

This error is already recorded and fix is to re-type the Double Quotes in the Expression.

You should be able to find the Error and its fix also here :

H! @BNK

Simply you can try like this.
image

@BNK

Date2 = DateTime.ParseExact(Date1.ToString, “M/d/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyy.M.d”)