Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Convert day and year to date

oneillp111
9 - Comet

I am super new to Alteryx, talking like a week and half.  I am trying to convert a date from the format YDDD to mm/dd/yyyy.  For example:

 

I have a cell that contains 8263, which is the 263rd of 2008, 9/19/2008.  I can do this in VBA and python, just cannot figure out the right formula in Alteryx.  Can anyone help me or point me in the right direction? 

 

Thanks.

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

How about this?

 

DateTimeAdd(
ToString(
	ToNumber(
		left(ToString([Field1]), 1)
		)+2000
	)+
"-01-01",toNumber(substring(Tostring([Field1]),1))-1
,"days")

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
neilgallen
12 - Quasar

@oneillp111  One other approach would be in a formula tool use:

 

datetimeparse((tostring(2000+tonumber(left([Field],Length([Field])-3)))+right([Field],3)),"%y%j")

Alteryx recognizes julian dates, which is what you're working with here.


That said, this is the standard date format which is YYYY-DD-MM, and not the format you specified below. Wrap the above in a

 

datetimeformat([above formula],"%m/%d/%Y")

 

and you would get your desired output.

estherb47
15 - Aurora
15 - Aurora

Welcome @oneillp111 

I took a similar approach to @MarqueeCrew , just broke it down step by step.

image.pngimage.pngimage.png

Cheers!
Esther

Labels
Top Solution Authors