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

Alteryx Designer Desktop Discussions

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

Date Function

micky01
7 - Meteor

Hi All,

 

I have a formula tool  which calculates 'DateTimeToday() '  but I want to display  the output as DD-MMM-YY.

 

Any thoughts.

 

Thanks

9 REPLIES 9
JosephSerpis
17 - Castor
17 - Castor

Hi @micky01 you would need to wrap that function in a datetimeformat function and ensure the data type is a string to get that output. I mocked up an example let me know what you think?

 

Dates_17022020.JPG

JulioMO
9 - Comet

Hi @micky01 

 

Try to add the "DateTime" Tool in order to display the date in the required form.

Qiu
21 - Polaris
21 - Polaris

@micky01 

Like this

Capture47.PNG

messi007
15 - Aurora
15 - Aurora

@micky01,

 

Please see below: 

 

DateTimeFormat(DateTimeToday(),"%d-%b-%y")

 

Regards,

NitishSrivastava
7 - Meteor

 

 

Hello @micky01,

 

You can try this. It will be helpful for you.

 

NitishSrivastava_0-1613557891598.png

 

Thanks

Nitish

 

micky01
7 - Meteor

Thank you Joseph.

 

Just wondering how to get this format DD-MMM-YY.

JosephSerpis
17 - Castor
17 - Castor

Hi @micky01 Alteryx only recognises YYYY-MM-DD e.g. 2021-02-17 as a valid date data format any other format such as DD-MMM-YYYY 17-Feb-2021 has to be a string data format. The rationale is the datatime functions within Alteryx only work with YYYY-MM-DD formats.  The function datetimeformat(DateTimeToday(),"%d-%b-%y") will give you a format of DD-MMM-YY lowercasing the y changes the format of the year. The specifiers for datatime functions can be found here.

Emil_Kos
17 - Castor
17 - Castor

Hi @micky01,

 

Like @JosephSerpis stated. If you are interested in keeping the format that you have mentioned you need to change the data type to string.

 

If you will use the formula tool and change the data type to string you will get something like this:

Emil_Kos_0-1613562463528.png


I have used the below formula in order to get this result:

 

DateTimeFormat(DateTimeToday(),'%d-%b-%y')

micky01
7 - Meteor

Thank you Joseph for detail explanation.

Labels