Announcement | We'll be doing maintenance between 2-3 hours, which may impact your experience. Thanks for your patience as we work on improving the community!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Function to output a week string?

bryanmac_92
8 - Asteroid

Hello,

 

I am trying to create a function where it will give you a week range date where if you run the function today it will give you the last 7 days as a range. ie. "3-22-23 to 3-29-23".

 

My best guess is: DateTimeAdd(DateTimeToday(),-7,"day") but not so sure.

 

Does anyone have any idea to replicate the range ("3-22-23 to 3-29-23") given if 3-29-23 is when the workflow is run?  

 

1 REPLY 1
Luke_C
17 - Castor
17 - Castor

Hi @bryanmac_92 

 

Your formula is correct - just a matter of formatting it:

 

More on datetime functions: DateTime Functions | Alteryx Help

 

DatetimeFormat(DateTimeAdd(DateTimeToday(),-7,"day"),'%m-%d-%Y') + ' to ' + DatetimeFormat(DateTimeToday(),'%m-%d-%Y')

 

Luke_C_0-1680138226796.png

 

 

Labels
Top Solution Authors