Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

YYYY format in Date Datatype

Highlighted
7 - Meteor

Hello everyone,

 

Happy Friday!  Been stuck on this one for a bit.  None of the posts I've looked through indicate a solution.  I'm trying to set a date column to yyyy format.  So, I first change the date in the formula tool using DateTimeYear([INCEPTION_DATE]) and it converts it to string.  Later in the workflow I use the Datetime tool to convert it back to Datetime from String using the custom format of yyyy.  But the output shows yyyy-mm-dd.  How can I get it to be a Date datatype and shows yyyy?

 

Thanks in advance for reading this.  

 

Kristin

Highlighted
9 - Comet

So date datatypes are all YYYY-MM-DD and datetime YYYY-MM-DD hh:mm:ss. If you want a string of the year, DateTimeFormat([date], "%Y") will do it.

 

Does that answer your question?

 

EDIT: Or your function DateTimeYear([INCEPTION_DATE]) will get the year too it looks like. Bottom line, date and datetime are structured fields and you cannot change the presentation

Highlighted
7 - Meteor

Ok so there isn't a way to format yyyy as a date.  Got it.  Thanks!

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

You're right, @Kristin 

 

I'd recommend you to use Year as a Number, so calculations and sorting are easier to do.


Cheers,

7 - Meteor

There's a governing body that is requesting it to be in this format.  I'm not sure this is something I can negotiate.  I was hoping that I could set it up to be a date type yyyy-mm-dd and then use the formula tool to Left([DATE FIELD],4) as a hack.  But, this doesn't work either.  

Highlighted
17 - Castor
17 - Castor

hi @Kristin 

 

Does your governing body have visibility into your workflow, or do they only see the output?  If it's the later then use one of the options provide to extract the year just before the output.  If its the former, then challenge them to show you any system that can internally represent a date data type without a month or day value.

 

Dan

Highlighted
7 - Meteor

They only see the output and I'd have to agree with you.  Not even Excel or Oracle accept this format.  I appreciate all the feedback.  I'm going to close this out.

Highlighted
7 - Meteor

I got on the phone with an associate from this governing body today, and it turns out they weren't a developer and didn't know that yyyy wasn't a Date datatype.  I didn't know either so I can't point fingers...I just always assumed you could change it from string/custom.  Lesson learned.  Thanks folks!

 

Kristin

Labels