To check if a date column is in YYYY-MM-DD format, if not to give "Fail" as the result
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
ignore me 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you! This worked the magic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
