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 Date to String without using the DateTime tool

Adam_Dooley
8 - Asteroid

Hello.  I have a need to get the first date of the prior month and display it in plain English.  In my formula tool I have:

todate(datetimeadd(DateTimeFirstOfMonth(),-1,'month')) 

which converts it to Alteryx syntax fine.

 

Then with the DateTime tool I'm able to convert to a string using the "Month dd, yyyy" format.  Which works great but I'd like to just do it all within one formula tool.  What is the syntax for that?  Is there a Regex/Date formula to convert that all in one?  The column with the red arrow is what I need. 

 

Capture.PNG

 

3 REPLIES 3
patrick_digan
17 - Castor
17 - Castor

@Adam_Dooley  Try this in a formula tool:

 

DateTimeFormat(datetimeadd(DateTimeFirstOfMonth(),-1,'month'),"%B %d, %Y")

Edit: The datetime specifiers are here in the help docs.

 

DiganP
Alteryx Alumni (Retired)

@Adam_Dooley You can use the datetimeformat() function to get this done.I nested this formula in front of the formula you provided.

 

datetimeformat(ToDate(DateTimeAdd([Date],-1,"month")),'%B %d, %Y')

%B - month (September)

%d - day  (01)

%Y - year (2019)

alteryx_logo.png

Attached is the workflow. Does that help?

Digan
Alteryx
Adam_Dooley
8 - Asteroid

Boo ya thank you both!  

Labels