Excel input has a date column with 2 different date formats
- 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
The Excel input file has 2 different dates, both are formatted as a general number so they come into Alteryx as a V-String. When I use the DateTime Parse tool, and convert string to date/time format from mm/dd/yyyy to yyyy-mm-dd, the 2nd format of yyyy-mm-dd converts to [null]
Is there a way to convert both formats to yyyy-mm-dd, Alteryx default date format?
Thank you
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @bh1789, your 2 bottom dates are already in the correct format for Alteryx so we can just check whether or not ToDate() results in a null and if so, apply DateTimeParse(), leaving the other, already correct dates, as they are:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @bh1789 ,
Here is the solution (i hope) ;-).
I used the formula tool for it :-).
By the use of regex it tests if the condition is met in that it matches your first way of writing dates, if not it assumes it is the second format. For both formats i converted them with datetimeparse to the Alteryx format.
You only need the first formula, the rest was just for testing :-).
Greetings,
Seb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hi @bh1789 ,
You can use the BB Date Macro to have it to normalize the date format automatically:
attached is the workflow.
If this helped to solve your issue, please make sure to mark it as a solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you Carli, the BB Date Macro worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@bh1789 the workflow you attached above is still using the Regex_Replace solution - I was saying that the workflow/expression I posted initially works fine.
