DateTime Format Question
- 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
I am confused as to why this error is popping up when I try to change the data type from V_String to Date. It has worked for other sets of data formatted the same way so I don't understand what I am doing wrong.
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hi @WillFrank13
you can overcome the error by using DateTime tool.
If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.
Many thanks
Shanker V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @WillFrank13,
You can only use the select tool to convert text to a date if it is in the Alteryx Date format (yyyy-MM-dd) already. You will need to use the datetime tool or datetimeparse function to convert it to a date. For example using the formula tool try: DateTime Functions | Alteryx Help
datetimeparse([ShipDate],"%m/%d/%Y")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you have the VString date as 2023-12-31 it is in YYYY-MM-DD alteryx format, you can easily covert to Date format
But if you have in other formats, you need to use Date Time tool
If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @WillFrank13
Please find the sample dataset used to explain your issue.
Input:
Output:
Error Message:
If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @WillFrank13
The pattern for dates inside Alteryx is YYYY-MM-DD, your field has a different format (MM/DD/YYYY). Because of this the select tool conversion is not working directly. To do this you must convert the MM/DD/YYYY format to YYYY-MM-DD format.
One way of doing this is with the datetimeparse formula.
datetimeparse([Field1], "%m/%d/%Y")
INPUT
OUTPUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you @IraWatt, that did help with one set of dates but I am not getting this error for a different set of dates. Do you know how I can fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @WillFrank13
Because the other set of dates are in other format YYYY-MM-DD
Hence you need to apply the formula
datetimeparse([ShipDate],"%Y/%m/%d")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Glad it helped @WillFrank13, I would recommend checking out the getting started learning path on the community it has some great and quick interactive videos which will help you get started with the basic tools in Alteryx: https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons
