Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extracting the Date in a File

KamenRider
11 - Bolide

HI Guys,

 

Can someone help me modify the formula below to get the date on the filename. Example

 

0000220454_20230710_FE_v01.xks

0000110383_20230721_FE_v01.xks

 

The formula is

 

DateTimeParse(REGEX_Replace([FileName], '[^\d{8}]', ''),'%Y%m%d')

 

I also welcome new ideas.

 

Thank,

Kamen

3 REPLIES 3
Prometheus
12 - Quasar

@KamenRider I used a RegEx tool's Parse function with this expression: ^\d{10}\_(\d{8}) then used a Formula tool and applied your expression to the field the RegEx tool created: DateTimeParse(REGEX_Replace([RegExOut1], '[^\d{8}]', ''),'%Y%m%d').

RegExParse.PNG

ToDate.PNG

binu_acs
21 - Polaris

@KamenRider One way of doing this

image.png

Prometheus
12 - Quasar

@KamenRider @binu_acs 

Oh yes. This is great because it creates a nested expression to parse and create the date in one.

Labels
Top Solution Authors