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

Convert Text to Date

britknip
7 - Meteor

I am having an issue converting my text to a date. This is the current format 20180124. I would like to pull out year and month. Any suggestions? I have tried using a select tool and converting the DateID from V-String to String and then using formula DateTimeFormat([DateID],"%Y-%m") 

 

Everything comes back Null.

 

Any suggestions?

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@britknip,

 

As text, you could use:

 

left([DateID],4) + "-" + Substring([DateID],4,2)

That's one way to get it done.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
britknip
7 - Meteor

That worked perfect. Thank you!

LordNeilLord
15 - Aurora

Hey @britknip

 

What is the final format that you are looking for your date to be in?

 

To turn your string into a "real" date use: DateTimeParse(ToSTring([Field1]),"%Y%m%d")

 

The next step will be dependant on your final requirement. I always use this page when trying to figure out the datetime functions: https://help.alteryx.com/9.5/Reference/DateTimeFunctions.htm

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

 

 

britknip
7 - Meteor

The previous user helped me but this link is awesome. Very helpful. Thank you!

Labels
Top Solution Authors