Get YYMM format from the EnteredTime context object in Step Function

Using intrinsic functions get an item formatted YYMM from the context object EnteredTime.

Using Step Functions intrinsic functions you can get from the context object EnteredTime an item formatted like YYMM. This way you don't need to use a lambda function to produce that. This is using many nested functions to parse the EnteredTime variable that looks like this: 2019-03-26T20:14:13.192Z. First it splits it using the T and then it gets the first two element from the first array.

Use intrinsic functions to get an item formatted YYMM from the context object EnteredTime

States.Format('{}{}', States.ArrayGetItem(States.StringSplit(States.ArrayGetItem(States.StringSplit($$.State.EnteredTime, 'T'), 0), '-'), 0),States.ArrayGetItem(States.StringSplit(States.ArrayGetItem(States.StringSplit($$.State.EnteredTime, 'T'), 0), '-'), 1))
                                


Created by:

Marcia Villalba

Marcia Villalba

Marcia hosts the FooBar Serverless YouTube channel where she publishes content every week related to serverless and the cloud. She has been designing and developing software professionally for 15 years and worked in all the different stages of building scaling and performant software.

Follow on LinkedIn