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.
SOLVED

Convert date to just number of the month

ChristophVW
6 - Meteoroid

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

 

6 REPLIES 6
AngelosPachis
16 - Nebula

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
6 - Meteoroid

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

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

ZarinShaikh
5 - Atom

How do I convert "16-JUN-01' to date format

caltang
17 - Castor
17 - Castor

Using a DateTime Tool:

caltang_0-1683299325542.png

 

The %b symbolizes the 3 letter word for Month, whereas %B is for the full name of the month.

 

Hope this helps.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels
Top Solution Authors