In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

How to Add Years to a Date Field

johnnykoung
8 - Asteroid

Hi,

I was wondering how I would add 10 years to a date field I have. For example Start Date is 9/5/2019 add ten years and End Date is 9/4/2029

Thanks,

Johnny

1 REPLY 1
lmorrell
11 - Bolide

Hi @johnnykoung 

 

Solution is attached. 

 

There are two ways you could get this done - both solutions have the formulas in the attached workflow.

 

You can convert your date to a datetime field and then use the function 

DateTimeAdd([Date], 10, 'years') 

to add 10 years AND have your date formatted as a datetime field.

 

If you only need the year to update and will do your processing at a different point in the workflow you can use the formula

left([Date], Length([Date])-4) + tostring(tonumber(right([Date],4))+10)

 to add 10 years to your year field.

 

Hope this helps!

Labels
Top Solution Authors