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!

SOLVED

Convert date to just number of the month

ChristophVW
5 - Atom

Hi all, 

 

I have column with "date" date type field and the values there are for instance "DEC-20", "NOV-20". 

 

I would like to change this column to the number of the month, e.g. "12", "11", ... . 

 

Anyone has a simple solution to do so? 

 

Alternatively, it it's easier to convert to the month number from the string, please say so. In my workflow I currently converted the string already to a date field. So both options are fine for me.

Really appreciate your help and many thanks in advance. 

Have a nice day,

Christoph

 

AngelosPachis
14 - Magnetar

Hi @ChristophVW ,

 

You can try using the DatetimeMonth() function which will return you the numeric value for a month in a date field.

 

So if your date field is called [Order Date] then the formula you should use is:

 

 

Tostring(Datetimemonth([Order Date]))

 

 

Hope that helps,

 

Angelos 

ImadZidan
12 - Quasar

Hello @ChristophVW ,

 

Have a look at the attached. Hopefully it will give you an idea.

ChristophVW
5 - Atom

Thank you very much @AngelosPachis ! Works like a charm.

 

Only did a very minor tweak from 'Tostring' to 'Tonumber' in my case, but visually the same.

AngelosPachis
14 - Magnetar

Thanks @ChristophVW ,

 

Try removing the 'Tonumber' part of the expression and see if it works without it. What the DateTimeMonth function returns to you is already a numeric value, so probably you can remove that part of the expression to make it less complicated.

 

Cheers,

 

Angelos

Labels