community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

How to extract month and year from a date?

Meteor

I would like to convert a date field to month-year (e.g. convert 03-25-2019 to March-2019, or Mar-2019, or 03-2019, the format isn't really important to me.) I know that I can extract the year and the month from a date by using Datetimeyear() and Datetimemonth() respectively but what if I want to extract both?

Bolide

Simple solution would be

 

Datetimeformat([Date], '%B-%Y')

Alteryx Certified Partner

The first step will be to reformat the input of "03-25-2019" into the Alteryx/ISO 8601 date format of "YYYY-MM-DD". You can do this with the following formula:

 

DateTimeParse([Input],"%m-%d-%Y")

 

Then it's just a matter of reformatting this into the desired output. In this case:

 

DateTimeFormat([ISO8601],"%B-%Y")

 

Both steps can be combined with one formula step:

 

DateTimeFormat(DateTimeParse([Input],"%m-%d-%Y"),"%B-%Y")

Bolide

This is a handy resource for datetime functions in Alteryx:

https://help.alteryx.com/10.1/Reference/DateTimeFunctions.htm

Meteor

Try one of these in Formula tool:

 

DateTimeFormat([Date],'%b-%Y') or DateTimeFormat([Date],'%B-%Y') or DateTimeFormat([Date],'%m-%Y')

 

Various format options can be found here:

http://downloads.alteryx.com/betawh_xnext/Reference/DateTimeFunctions.htm

 

 

Meteor

Thank you so much CharlieS. This did the trick!

Atom

How can I get Year/Month in Numeric format from there itself. I dont want to go any step like select function.

Labels