Adding year on to date field using field calculator

980
1
08-26-2020 07:46 AM
DarrenDe_Lange
New Contributor III

Hi there all

I am trying to automatically add a year, to a known date in a field, in to a newly, created field in the attribute table.

So if user enters today's date, the new field should show today's date + 1 year. 

I tried this code in the field calculator of the attribute table = DateAdd('yyyy',[$feature.year],[$feature.date]) - but the field entry stays as 'NULL' even though the code is verified and pliable.  

I am open to other suggestions if there is another work around, just needs to happen automatically when the user enters a new date (not sure if there is an ArcPy work around). 

thank you for any assistance! 

0 Kudos
1 Reply
JoeBorgione
MVP Emeritus

Not arcpy per se, but take a look a the datetime.timedelta() function in python.

That should just about do it....