Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to display single digit month and day

ELPC
8 - Asteroid

Hi, I have a field with 1/1/2022 00:00 that Alteryx automatically change to a Date data type.  I want to change it back to a string to show "1/1/2022 00:00".  I used the DateTime tool to change it a string format using the formula %m/%d/%Y %H:%M but that results in 01/01/2022 00:00.  I need the month and day to only show one digit for the months that only have 1 digit.  Can someone help me with a formula for a one digit month and day?  Thanks. 

3 REPLIES 3
Luke_C
17 - Castor
grazitti_sapna
17 - Castor

@ELPC  You can use formula tool to trim the data. Here is the configuration of the tool

 

grazitti_sapna_0-1663043717921.png

 

Sapna Gupta
flying008
14 - Magnetar

Hi,@ELPC 

 

There are 2 easy formulas for you:

 

1- If you want use classic Replace function, use the below formula:

 

TrimLeft(Replace(ToString([Date]),"/0","/"),"0")

 

 

2- If you like use RegEx function, then use the formula:

 

REGEX_Replace(ToString([Date]), "0(?=\d\/)", "")

 

flying008_0-1663043845614.png

 

 

*******

If this formula as your want, please mark it as a solution for more share.

Labels