Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Convert month to number without leading zero

mestra28
6 - Meteoroid

Hello,

 

I currently wanted to construct a workflow that pulls in the last month as a number without a leading zero.

I came up with this:

(DateTimeFormat(DateTimeAdd(DateTimeFirstOfMonth(),-1,"months"),"%m")

However I want to get rid of the leading zero.

 

3 REPLIES 3
binuacs
21 - Polaris

@mestra28  the TrimLeft function will be useful in this use case

 

binuacs_0-1649887453571.png

 

 

 

 

 

TrimLeft( DateTimeFormat(DateTimeAdd(DateTimeFirstOfMonth(),-1,"months"),"%m"),'0')

 

 

Qiu
21 - Polaris
21 - Polaris

@mestra28 
you mentioned that you want a number, so use ToNumber function to convert the string to number will natually remove the leading zero.

0414-mestra28.PNG

mestra28
6 - Meteoroid

@binuacsThis worked, thank you!

 

Labels
Top Solution Authors