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

Substringing a date

Izbiz
8 - Asteroid

Hello!

 

I have a date column where the dates are given like "20110601" (year, month day)

 

I am going to seperate out the date parts and convert this to a date time . 

 

However I get an issue when using a formula tool as follows:

 

LEFT([0CALDAY],4) + '-' + substring([0CALDAY], 5,2) +'-' + RIGHT([0CALDAY],2) 

 

returns "2011-60-01" - so the substring function is getting rid of the lead zero. Anyone know any work arounds for this?

 

Thanks!

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @Izbiz

 

You can use the DateTimeParse function to convert this date:

 

Date.PNG

ponraj
13 - Pulsar

You can also use datetime tool to convert your string into date. 

 

workflow.PNG

Izbiz
8 - Asteroid

Thanks - great solution!

Izbiz
8 - Asteroid

Thanks - good to know this

Labels
Top Solution Authors