Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Date Formatting

jlfromm
8 - Asteroid

I have a date in my excel file as YYYY-MM-DD and I need to convert it to MM-DD-YYYY how do I do this

3 REPLIES 3
binuacs
21 - Polaris

@jlfromm  DateTimeFormat([Date],'%m-%d-%Y') should work

binuacs_0-1666190956493.png

 

jlfromm
8 - Asteroid

another question if I have a date in some of the cell and some cells say "na" or Other Notes which i need those notes to stay in that cell

 

 

jlfromm_0-1666193057921.png

 After I put this formula in then in those cell I get 

jlfromm_1-1666193175383.png

Christina_H
14 - Magnetar

You need to check whether the original data is a valid date.  Here are some options:

 

if IsNull(DateTimeFormat([Next review],'%m-%d-%Y')) then [Next review] else DateTimeFormat([Next review],'%m-%d-%Y') endif

 

if REGEX_Match([Next review], "\d{4}-\d{2}-\d{2}") then DateTimeFormat([Next review],'%m-%d-%Y') else [Next review] endif

This one won't return conversion errors since it checks the format first.

Labels