Alteryx Designer Desktop Discussions

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

Trouble with DateTime Tool

Adam_B
8 - Asteroid

Hello, 

 

I have a Date field that I need to convert to a short date as it is not flowing throughout the workflow.  

The date appears as shown below: MM/dd/YYYY hh:mm:ss in the APH REQ Action date field. 

Adam_B_2-1680803267158.png

 

I am using the DateTime tool:

 

Adam_B_0-1680803061334.png

 

My new field is all NULLS

Adam_B_3-1680803512571.png

 

Not sure I know why. 

 

Thanks, 


Adam 

 

 

 

9 REPLIES 9
DanielG
12 - Quasar

@Adam_B   I think because you dont have seconds in there.  Try custom with this:  

DanielG_0-1680803801769.png

 

 

DanielG
12 - Quasar

DanielG_1-1680803916230.png

My results come through with this alteration.  :)

DanielG
12 - Quasar

Check this post out for converting AM/PM to correct hours, as the conversion above doesnt account for that difference.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Convert-12-hour-to-24-hours/td-p/76025...

Adam_B
8 - Asteroid

@DanielG That worked, but I want to the Output field to be MM/dd/YYYY without the time. 

Adam_B
8 - Asteroid

@DanielG Actually the Year is first then the month, then the time. 

Adam_B_0-1680804836709.png

 

DanielG
12 - Quasar

Alteryx date fields are YYYY-MM-DD so when you use the Date/Time tool that will be your output.  You can just drop the time with a following select tool where you change Data Type from DateTime to just Date.  ðŸ˜€

 

If you just want to cut the time off but leave it as a string, then use text to columns as such...

 

and drop the 2nd column by deselecting it with a select tool.

 

DanielG_0-1680805038562.png

 

Adam_B
8 - Asteroid

@DanielG ok, I will try that, but why is the output backwards. 

Adam_B_0-1680805302019.png

 

DanielG
12 - Quasar

Because Alteryx uses YYYY-MM-DD as their standard date structure.  So when the DateTime Tool asks for your input string format it knows where to find the bits and pieces of the data to construct an actual date/time field for you.  You can do it with a bunch of formulas, but it is much easier to use the DateTime Tool.  Otherwise your date field is just a string that Alteryx would be able to perform date calculations on.

Adam_B
8 - Asteroid

@DanielG Thank you!  That all worked and I am good, I appreciate your time. 

 

Adam 

Labels
Top Solution Authors