Substring in the middle of a string

I am trying to get the month in a date string, the string comes in from an API as a text value "20250616". I was able to successfully get the year by using substring (0, 4). However when I try substring (4, 2) to get the month, the result comes out as empty.

How can I get 2 characters in the middle of a string?

image

Hello!
What if you try (4, 6)? :thinking:

It still shows up as empty:

image
image

Shouldn't it be date.substr(4,2)?

you don't need .toString() again as it is already a string

I think the actual problem is that you have two values as date
Try to rename your second set value step to date2 or year

Thank you @franse

It seems that the same variable name was causing the issue"
image

1 Like