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

Date Time Parse

kevin-lindorfer
7 - Meteor

Hello!

 

I am attempting to save a file in a different folder each month for a monthly audit that we perform.

 

I am using the following function to attempt to get "03 March" to be the end result, and I am in need of help to parse out the date to make that happen.

 

DateTimeAdd(DateTimeParse(dt,f)DateTimeLastOfMonth(),-1,"months")

 

The bolded portion is the part I am confused on.

 

So before I add the DateTimeParse function, I get 2018-03-30 23:59:59 as the output. I'd like it to output as "03 March", or Month Number then Month Name, all using the DateTimeAdd function so that I do not need to update the formulas each month.

 

Is this the right way to approach this, or is there a better way?

 

Many thanks.

Thanks so much!

4 REPLIES 4
patrick_digan
17 - Castor
17 - Castor

@kevin-lindorfer I think you would want DateTimeFormat() instead. Something like this:

 

DateTimeFormat(DateTimeAdd(DateTimeLastOfMonth(),-1,"months"),"%m %B")

PS I can't keep DTFormat and DTParse straight either...

Kenda
16 - Nebula
16 - Nebula

Hey @kevin-lindorfer

 

Try adjusting your formula to look like the following:

datetimeformat(DateTimeAdd(DateTimeLastOfMonth(),-1,"months"),"%m %B")

I changed the DateTimeParse to DateTimeFormat and moved it to the beginning. 

 

Hope this helps!

kevin-lindorfer
7 - Meteor

Thank you to both of you! I got those confused for sure :)

MarqueeCrew
20 - Arcturus
20 - Arcturus

@kevin-lindorfer,

 

The desired field type that you're trying to achieve is a "String".  It will actually be a variable length because the month names vary (V_String).  

 

In creating this field, you might use a formula like you have below, but as it is nested with multiple functions being performed at once there may be some that will tell you to break the formula down to their individual components.  Depending upon your comfort level with understanding the functions and the likelihood that you will need to maintain or train others in the details of the workflow, you may decide to take different configuration options.

 

https://help.alteryx.com/2018.1/index.htm#Reference/DateTimeFunctions.htm

 

DateTimeFormat([Date],"<Format>") is what you'll need.   So for this example:

 

DateTimeFormat("2018-03-30",'%m %B")

Gets you your month.

 

Now to calculate the month prior to the current date....  I see lots of posts being made and will pause.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels