community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Community v19.9

The latest release includes several enhancements designed to improve your Community experience!

Learn More

Date Conversions - remove hh:mm:ss

Atom

Hi everyone, 

 

I have an issue that I can't figure out by myself:

 

I have a date that looks like this: 2017/05/20 18:21:48 , string type. I need to convert it into a date and make it look like this. 05/20/2017

 

I tried to separate the initial text using Text to Columns and Left Formula and then I used Date/Time Function to convert the resulted string into a date type. 

 

Every time I get the same result: After separation I get the string 2017/05/20 but then, when I apply the Date/Time Function, I get this result: 20-03-2017 00:05:00

 

I would really appreciate your help, 

Thanks so much. 

ACE Emeritus
ACE Emeritus

Dates in Alteryx always look like YYYY-MM-DD.  If you want it to look like MM/DD/YYYY, you'll have to leave it as a string. 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Pretty much as the above poster says, i've used a slightly different method to get your desired output, but again it can only be a string given your desired format which I would recommend not doing!

 

Ben

Quasar
Quasar

And here is a way to do it with a single formula:

 

DateTimeFormat(DateTimeParse([Date],"%Y/%m/%d"),"%m/%d/%Y")

Could you please share the method you use in here, as I'm unable to download your WF

Alteryx
Alteryx

@dana_buz wrote:

 

Every time I get the same result: After separation I get the string 2017/05/20 but then, when I apply the Date/Time Function, I get this result: 20-03-2017 00:05:00

 

 


Hi @dana_buz just reading the above it looks like you are specifying the field type to be a date/time within Alteryx. If this is the case it will always remain in the Alteryx date format of CCYY-MM-DD HH:MM:SS.

 

If you need the date to be formatted in a different way that's fine, you will just need to have the field type as a string. Do note that this will then mean they aren't able to be treated as dates in formulas and filters etc if you do something like [MyDate] > "2017-10-09".

 

The above post with the expression can be used in a formula to parse you field and then format it to the desired output.

 

Thanks

Joe

 

Edit: oops just seen the original post is a little old. So that may no longer be relevant

Labels