Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Convert V_WString to Mon.-yy Date Format on multiple fields

peyton-brooks
5 - Atom

Hi, as stated in the subject line I need to convert multiple V-WString fields to Date fields and I want them to come out in Mon.-yy format.  The V_WString is currently in Mon.-yy format, but of course it is text vs. an actual date.  I appreciate the help in advance!

11 REPLIES 11
MelGibson
10 - Fireball

I am not understanding your ask. Your incoming data is Mon.-yy and you want the output to Mon.-yy. Mon.-yy is not a date type format so to my knowledge you cannot force it to be date. Date = Nov.-24?

alexnajm
17 - Castor
17 - Castor

Agreed with @MelGibson - either it's going to be a Date format as YYYY-MM-DD or it's going to be a string data type if it's in any other format

peyton-brooks
5 - Atom

Thank you both for responding! Ok, I gotcha.  So just to confirm, for Alteryx to recognize the string as a date data type, it can absolutely only be YYYY-MM-DD? 

 

I want the output to be Date = Nov. 24 or Nov-24, any variation of month/year would work.

alexnajm
17 - Castor
17 - Castor

That’s correct. And I think we are both confused, what is the original value’s format? if it is in a date format, you would use the function datetimeformat to take that value and use specifiers to get it the way you want: https://help.alteryx.com/20232/en/designer/functions/datetime-functions.html

peyton-brooks
5 - Atom

Ok thanks. What is the best way to utilize the multi-field formula tool to convert the V_WStrings to Date format? 

MelGibson
10 - Fireball

If you cannot have a date type with the format you requested above - what date type would be acceptable?

alexnajm
17 - Castor
17 - Castor

@peyton-brooks I think we are still both confused about what you are trying to accomplish now. Please provide your current starting data (even a sample) and your expected output.

OllieClarke
15 - Aurora
15 - Aurora

@peyton-brooks if you want to convert multiple fields from Mon.-yy into actual dates, then you can use this formula:

datetimeparse([_currentfield_],'%b.-%y')

Like this:

image.png
(I've ticked the 'Copy output fields and add' option to demonstrate the change here)

Make sure to change the output type to date.

 

Hope that helps,

 

Ollie

OllieClarke
15 - Aurora
15 - Aurora

@peyton-brooks If at the end of your workflow you want to convert these back to the original format as a string, then 

datetimeformat([_currentfield_],'%b.-%y')

will reverse the change

Labels