Hi all,
I have 3 columns(creationDate, startDate and endDate ), i want to split these columns into a day, month, year, hours, minutes, seconds. for each column.
The output is :
creationDate-day | creationDate-month | creationDate-year | creationDate-hours | creationDate-minutes | creationDate-seconds | startDate-day | startDate-month | startDate-year | startDate-hours | startDate-minutes | startDateseconds |
06 | 10 | 2019 | 16 | 32 | 33 | 06 | 10 | 2019 | 16 | 32 | 00 |
How i can do it?
thanks
Solved! Go to Solution.
Hi @Inactive User !
You can try the DateTimeFormat function on each column. I'd use a multifield formula tool, to convert all 3 columns at once into the respective pieces
e.g., for the month, DateTimeFormat([_CurrentField_],"%m")
Each piece has a code to use for the information you want to pull out.
Let me know if that helps!
Cheers,
Esther
And here's a link to the help page with the definition of the format codes:
https://help.alteryx.com/current/designer/functions/datetime-functions
Cheers!
Esther
It also can be done in a Formula tool using DateTimeYear(dt), DateTimeMonth(dt), etc.
@Inactive User
Using the Formula tool and the DateTimeFormat function is one option
You can also use the TextToColumns tool and split on colon, hyphen and a space