Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

DateTimeParse Changing Order of Figure

datadiver
5 - Atom

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

4 REPLIES 4
ChrisTX
15 - Aurora

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

datadiver
5 - Atom

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?

binuacs
20 - Arcturus

@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

ChrisTX
15 - Aurora

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

Labels