Alteryx Designer Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!

Date time format in Alteryx designer ?

RVK_RM
7 - Meteor

Hello,

 

I am new to Alteryx, I have a question regarding the date and time format.

 

Input

DateTime                        

01-01-21 14.45.06

02-01-21 14.55.06

 

Output Expected

Date            Time

01-01-21     14.44.06

02-01-21.     14.55.06

 

In python 

pd.to_datetime(df_final['date'])

df_final['date'].dt.time

df_final['date'].dt.date

 

How can we do it Alteryx ?

 

mbarone
14 - Magnetar
14 - Magnetar

Alteryx only recognizes YYYY-MM-DD hh:mm:ss for "datetime" formats so first you'll have to do that.  You can use the "DateTime" tool on the RegEx palate for that.


Once it's in that format (2021-01-01 14:45:06) just add a new field via formula tool with type "date" and another with type "time" and it will strip off the applicable portions for you.

afv2688
15 - Aurora
15 - Aurora

Hello @RVK_RM ,

 

You can use the following formula to add the time formula:

 

DateTimeParse([Field1],'%d-%m-%Y %H.%M.%S')

 

Regarding the format, alteryx always uses the same format to display Date and Time which is the ISO:

 

YYYY-MM-DD HH:MM:SS

 

The only soltuion would be to change it to the expected format one you finish everything but you have to know that the cells would be strings (no longer dates).

 

Untitled.png

 

Regards

 

mbarone
14 - Magnetar
14 - Magnetar

Nice one @afv2688 !!  I forgot about DateTimeParse - can do it with just one tool that way!

RVK_RM
7 - Meteor

My date format is already in this "2021-01-01 14:45:06" format., Type is Date Time.

In the formula tool - The date preview is "Null".  

RVK_RM
7 - Meteor

I am getting the null value when I try to extract the date from the date time column.

 

 

Screen Shot 2021-02-08 at 8.23.06 PM.png

afv2688
15 - Aurora
15 - Aurora

Hello @RVK_RM,

 

Could you share an yxdb with some of the examples with me. I would be able to share then with you a solution.

 

Regards

Labels