Add or subtract years in a date

I have a date in CurDt and I want to add YrOffset to it and end up with a new date in a date format. YrOffset can be negative, positive or 0. I’m not sure how to do it.

Use the DATEADD([date], [#], 'units') formula function with 'years' as the units.

To add one year

DATEADD({Date Field}, 1, 'years')

To subtract one year

DATEADD({Date Field}, -1, 'years')

It is documented in the formula field reference.

1 Like

It worked except is added the time into the field. How do I get rid of the time and keep the date in a date format?

I figured out how to get rid of the time, but when I try to convert back to date format it adds the time back. Here is what I have right now:
DATETIME_FORMAT(DATEADD({Cur GM Yr},yrOffset,‘years’),‘MM/DD/YYYY’)

I figured out on the formatting setting I could tell it not to include the time.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.