How to extract month and year from a date?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You could use the DateTime tool from the Parse section.
Select Custom and type dd-Mon-yy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@CharlieS is it possible to extract Reformat as Mar-19 , your workflow extracts as March-2019.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Of course. You just need to change the "%B" (which gives you "March" to "%b" which gives you the abbreviated month name of "Mar". Also swap "%Y" for "%y" to output "19"
DateTimeFormat(DateTimeParse([Input],"%m-%d-%Y"),"%b-%y")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The Dates in the Text Input tool is provided in String datatype. You need to break the date string into Year, Month and Day and then use a formula tool to combine them back to Alteryx Date format. Finally use a Formula tool to construct the date back into the format of your choice. I have enclosed the solution as attachment. For other date formats, please visit the DateTimeFormat Function page DateTime Functions (alteryx.com)
Enjoy the day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you input date is already in the date format, you just need to use a formula tool and add this formula where [Input Date] is your existing date column.
DateTimeFormat([Input Date],"%b-%Y")
To know more on the Alteryx Datetime format please visit DateTime Functions (alteryx.com)

- « Previous
-
- 1
- 2
- Next »