Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

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 ?

 

7 REPLIES 7
mbarone
16 - Nebula
16 - Nebula

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
16 - Nebula
16 - Nebula

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
16 - Nebula
16 - Nebula

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
16 - Nebula
16 - Nebula

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

ELLobo
5 - Atom

that did not work for me but thanks 

 

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

Labels
Top Solution Authors