Alteryx Designer Desktop Discussions

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

To check if a date column is in YYYY-MM-DD format, if not to give "Fail" as the result

sucansa
7 - Meteor

Hi,

 

I am new to Alteryx and I have a use case to test if the column has records with date displayed in "YYYY-MM-DD" format. If not, I have to mark the result as fail. Any help on this is really appreciated..

5 REPLIES 5
JosephSerpis
17 - Castor
17 - Castor

Hi @sucansa I mocked up an example using this syntax in a formula. I attached the workflow let me know what you think?

 

IF DateTimeFormat([Date],"%Y-%m-%d")=[Date] THEN "Yes" ELSE "Fail" ENDIF 

 

Dates_Test_021019.PNG

TonyA
Alteryx Alumni (Retired)

@JosephSerpis 's solution has the added benefit of not just checking the syntax but verifying that the date is valid without doing a bunch of extra checks. So 2019-02-29 may have the right syntax but still be rejected.

JoeS
Alteryx
Alteryx

ignore me 🙂

sucansa
7 - Meteor

Thank you! This worked the magic.

swuenschel
5 - Atom

Thank you for this bit of code.  I've been struggling with how to test the date time formats prior to running them through Parse and getting errors.  

Labels