SOLVED
Convert month to number without leading zero
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
mestra28
6 - Meteoroid
‎04-13-2022
02:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
Labels:
- Labels:
- Alteryx Practice
3 REPLIES 3
binuacs
21 - Polaris
‎04-13-2022
03:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@mestra28 the TrimLeft function will be useful in this use case
TrimLeft( DateTimeFormat(DateTimeAdd(DateTimeFirstOfMonth(),-1,"months"),"%m"),'0')
21 - Polaris
‎04-13-2022
06:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@mestra28
you mentioned that you want a number, so use ToNumber function to convert the string to number will natually remove the leading zero.
‎04-15-2022
09:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@binuacsThis worked, thank you!
