Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Convert Number to Month

Gamaliel
10 - Fireball

Hello,

 

How can I convert a certain number to a month. E.g. For 1, I want to return the equivalent which is January.

 

Thanks.

7 REPLIES 7
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Gamaliel,

 

You could use the DateTimeFormat() function for this within a formula tool:

 

 

DateTimeFormat("2000-" + PadLeft(ToString([Month]),2,'0') + "-01",'%B')

 

 

Ensure your new field is a string data type (i've used V_WString in my example)

 

JonathanSherman_0-1625660634136.png

 

You'll find all the information about the various date transformation functions (DateTimeParse(), DateTimeFormat() being the main two but there's lots of others also available here: https://help.alteryx.com/current/designer/datetime-functions

 

I've attached my workflow for you to download if needed, if you've got any questions on the formulas just let me know!

 

Kind regards,

Jonathan

atcodedog05
22 - Nova
22 - Nova

Hi @Gamaliel 

 

You can use a formula like this. Convert to date and then to month name.

 

DateTimeFormat(DateTimeParse(ToString([MonthNo]),"%m"),"%B")

 

Workflow:

atcodedog05_0-1625660989523.png

 

Hope this helps 🙂 

Gamaliel
10 - Fireball

Sounds awesome. Thanks

Vaithi
7 - Meteor

Hi ,

 

What does the "%m" denotes in the below formula.  Your formula looks awesome.

 

"DateTimeFormat(DateTimeParse(ToString([MonthNo]),"%m"),"%B")"

 

Regards,

Vaithi

atcodedog05
22 - Nova
22 - Nova

Hi @Vaithi 

 

%m is the month i defining number to be treated as month and create date. This creates date on the min year and date would be something like 1900-02-01.  %B will convert to month name.

Vaithi
7 - Meteor

Great. thanks @atcodedog05 

OliverHosking
8 - Asteroid

Hello,

 

Here is my solution

Labels