We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

String: Extract two middle characters

NachoArg
7 - Meteor

Hi, 

 

I have the following string: "210617". That is 21= 2021, 06= Jun and 17=day.

 

Which is the formula to extract "06" ?

 

I used right with 2 in order to get the day and I used left with 2 in order to get the year, but I can´t find the formula to extract "06"

 

Regards,

Igancio 

5 REPLIES 5
mceleavey
17 - Castor
17 - Castor

@NachoArg ,

 

You can do this in a simple formula:

 

mceleavey_0-1623952876610.png

 

substring(tostring([Text]),2,2)

 

mceleavey_1-1623952895315.png

 

Hope this helps,

 

M.

 

 

 



Bulien

shreyanshrathod
11 - Bolide

@NachoArg , you could use substring('210617',2,2) OR you could use Regex_parse.

 

Regards,

Shreyansh

apathetichell
20 - Arcturus

 

 

Since you are probably running datetime calculations on it - why not just convert it to a date via datetimeparse("20"+tostring([field1]),"%Y%m%d")

 

then you can use datetimeformat([date],"%m") to get the month and do all those fun datetime calculations...

NachoArg
7 - Meteor

Thank you both !!   😊

 

Actually I was trying something like  +mid as I use in Excel.

mceleavey
17 - Castor
17 - Castor

no problem.gif



Bulien

Labels
Top Solution Authors