0

I have 2 fields one is Creation Date the other is Maintenance Date. The Maintenance Date should be 30 years after the Creation date.

I have been trying to use the field calculator for this. But I haven't been able to make this work.

Does anyone know how to do this?

  • What have you tried yourself? – Berend Feb 11 at 13:11
  • Some things I found online. But Khibma answered my question. – EmielG Feb 11 at 14:06
0

There are many ways to "Add" dates. Here's one in CalculateField (place these values into the last 2 boxes of the tool, updating the CreationDateField with your field name).

Field to update:

add30(!CreationDateField!)

Code Block:

from dateutil.relativedelta import relativedelta

def add30(start):
    update = start + relativedelta(years=30)
    return update

Reference: https://stackoverflow.com/questions/54394327/using-datetime-timedelta-to-add-years

| improve this answer | |
  • This is exactly what I was looking for. Thanks! – EmielG Feb 11 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.