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.

Date Conversion

Kaish
8 - Asteroid

Hi all I have a file in which I want to change the date format.

 

input data 

45426

 

Output Data

5/13//2024

 

Kindly guide me

15 REPLIES 15
Kaish
8 - Asteroid

Kindly, find the sample of my data set.

cjaneczko
13 - Pulsar

Just tested it and the code I put in my prior post works. Ive updated it to match the field name used in your example. 

 

if REGEX_Match([Date], '\d{5}') then todate(tonumber([Date])) elseif regex_match([Date], '\d+-\d+-\d+') then datetimeparse([Date],'%Y-%m-%d') else null() endif

  

Kaish
8 - Asteroid

I am getting Malformed if statement with this formula, my incoming date column data type is V_string and the new output datatype is date. Kindly guide where I am facing the problem.

cjaneczko
13 - Pulsar

You might not have copied the entire code? I have the same settings.

 

image.pngimage.png

Kaish
8 - Asteroid

As soon as I am typing '\d{5}' it starts throwing error 'Malformed if statement'. Can I know the reason ?

cjaneczko
13 - Pulsar

I had the same issue, but if you finish the complete statement it will work. Copy and paste from my prior two posts. If the name of the Date field is different, update the field name. 

Labels
Top Solution Authors