DateTimeParse Changing Order of Figure
- 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 have a column, td1, with dates stored as strings in the format of MM-dd-YYYY. I tried using DateTimeParse to convert the string into a date: DateTimeParse([td1], "%m-%d-%y"). However, the result I get is a date with the format YYYY-mm-dd. Would appreciate any help in determining what the issue is
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The output from DateTimeParse is a Date data type, which is formatted as YYYY-MM-DD.
A four digit year should be formatted using a capital %Y
https://help.alteryx.com/current/en/designer/functions/datetime-functions.html
In your output, which data type are you trying to get?
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for responding, Chris. I'm trying to get back to a date with the format MM-dd-YYYY in my output. Any way to do that with DateTimeParse?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@datadiver Alteryx only support the "YYYY-MM-DD" as the date type format, any other format will the string data type. If you want to convert a Date Type to a string type format you need to use DateTimeFormat() function. In your case you have already in the format of MM-dd-YYYY which is a string format. If you use the DateTimeParse() function it will convert it in to YYYY-MM-DD format, which is the standard date format in Alteryx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You mentioned:
you have dates stored as strings in the format of MM-dd-YYYY
you are trying to get back to a date with the format MM-dd-YYYY in my output
If you want a date in the format MM-dd-YYYY in your output, the data type of that "date" will need to be string.
Are you writing out to Excel? If you write out a String data type from Alteryx to Excel, then Excel will not recognize that column as a Date.
Are you trying to write out a Date data type to Excel, but have the date value displayed as MM-dd-YYYY inside Excel?
Chris
