Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Datetimeformat function

sophievanluin
7 - Meteor

Hi, I have  a question regarding the Datetimeformat function.

 

I had two different formats (strings) in my Date column:

4/19/2022 1:52:16 AM
5-3-2022 03:47

 

First, I've used the DateTime tool to change the dates to the same DateTime format:

2022-04-19 01:52:16
2022-05-03 03:47:00

 

Now I would like to change the format to

19-04-2022 01:52:16

03-05-2022 03:47:00

 

When I use the formula tool and type in the next function, I only get Nulls.What am I doing wrong here?

DateTimeFormat([Date], '%d-%m-%Y %H:%M:%S')

4 REPLIES 4
Ladarthure
14 - Magnetar
14 - Magnetar

Hi @sophievanluin,

 

I tried it and it works fine on my side, only thing you have to do is create a new column, not trying to replace the data you have in this column since it's a date and the only valid date format in alteryx is year-month-day.

 

I guess you try to modify the Date column, in your case, you shoudl create a new one :)

DataNath
17 - Castor

Hey @sophievanluin, I've tried your formula and it seems to be working fine (below):

 

DataNath_0-1654073910905.png

 

However, it is important to note that Alteryx outputs datetimeformat() as a string. Are you perhaps changing the output data type to DateTime? As that will cause a null:

 

DataNath_1-1654073956129.png

 

If you need the output as DateTime, you can stick another DateTime tool on the end of your output string as so:

 

DataNath_2-1654074139051.png

DataNath_3-1654074155152.png

 

 

IraWatt
17 - Castor
17 - Castor

Hey @sophievanluin,

That's strange seems to work fine for me. Is your output of type Date, that would cause the NULLs. Can you send a screenshot of your workflow?

IraWatt_0-1654074040070.png

 

binuacs
21 - Polaris

@sophievanluin I don't see any issues with the formula as well. Attaching a sample workflow for your reference. you can compare this workflow with the one which you created

 

binuacs_0-1654077181091.png

 

 

Labels