Alteryx Designer Desktop Discussions

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

How to convert a string to a date field

TysonSri
6 - Meteoroid

From the input file I am getting below data. In the below data it is populating unmatched date (which is highlighted below).

 

How do I convert the unmatched date "20220732" to "20220801"

 

 

TysonSri_0-1662046626080.png

 

3 REPLIES 3
DataNath
17 - Castor

Hey @TysonSri, I'm not sure if this is the only instance of this occurring, in which case you could correct it with a simple formula. However, I went down a bit of a rabbit hole as it looked like a fun challenge. This expression ought to be dynamic and essentially tells Alteryx: if the day (last 2 digits of the date field) is above the max days in that month, take that difference (in this case between 32 and 31 = 1) and add that to the last day of the month in question. In your example, the 32 date is correctly changed to the 1st of August and I also added another extra entry with 37 as the date which was correctly converted to the 6th of August.

 

DataNath_0-1662047766623.png

 

If this doesn't fit what you're looking for then please let us know and we can revisit!

TysonSri
6 - Meteoroid

Hi @DataNath

 

Thank you so much for detailed explanation. It is working fine now. 

DataNath
17 - Castor

No problem @TysonSri - happy to help! If this solved your issue then feel free to mark the solution so that others can easily find it if they have the same problem in future. If not, let us know and we can keep working towards a resolution! :)

Labels