Date Format Issue
- 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 All,
I have data coming in for a date in the format of Jul 22 2024 12:00AM and need the end result to be 07-22-2024. The incoming data type is a VWString and I need the final version to be in a Date format type. I have tried some of the other solutions posted and tried flipping back and forth with the date time tool but I keep getting an end result in date format data type of YYYY-MM-DD instead of MM-DD-YYYY.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Jshelp11 One way of doing this with the DteTimeFunction
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @binuacs
The problem with this is that output is still in a string format. When you try and convert that string format to a date with the datetime tool it flips the date format back to YYYY-MM-DD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Jshelp11 Alteryx support only the ISO format (YYYY-MM-DD) as the Date data type, rest of the all formats should be in String DataType
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Jshelp11 wrote:Hi @binuacs
The problem with this is that output is still in a string format. When you try and convert that string format to a date with the datetime tool it flips the date format back to YYYY-MM-DD
Review the Date Time Functions page. YYYY-MM-DD is the only "Date" format. As mentioned above all other formats are considered strings.
https://help.alteryx.com/current/en/designer/functions/datetime-functions.html#idm45439287072816
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
For the purpose of being able to run Date Time Functions, it is critical that only a single format be used to handle this data type. So as your workflow is run, you want to take all dates from inputs and convert them to the standard ISO 8601 format (yyyy-mm-dd) to make use of this helpful functionality. That being said, not everyone likes seeing dates in that format, and so best practice would be to wait until the end of your workflow and then convert those dates back into formatted strings that match the desired look of the date time. This way your workflow runs well and the output looks good!
Happy Solving!
