Looked at several similar questions but cannot find solution.

I'm working with some mosaic rasters that need a date fields added to them for a time dimension, but I don't want to do it manually. I've used the calculate field Sequential Number function for regular number fields, but it doesn't seem to work for a date field. I need the dates to start 8/31/1987 and go up by year (8/31/1988, 8/31/1989, and so on). If I use pStart=8/31/1987 pInterval=365 the result is the first record starting as 12/30/1899 12:00:10 AM and going up by year from there.

enter image description here

Any solutions?

  • Are you sure that is an ArcGIS Date field and not an ArcGIS Text field? A Date field would not show only the year unless you are using custom formatting.
    – bixb0012
    Commented Dec 22, 2022 at 21:24
  • @bixb0012 I am sure it is a date field, just have it set to display only the year. I think I have found a solution by just using the sequential number function to create a separate number/string field and then using the Convert Time Field Tool
    – b_squared
    Commented Dec 22, 2022 at 21:44

2 Answers 2


Here is an approach not involving creating additional fields and using additional tools:

# Field Name: Year
# Expression Type: Python 3
# Expression: Year = 
# Code Block
import datetime

def increment_year():
    base_year = 1987
    base_month = 8
    base_day = 31
    counter = 0
    while True:
        yield datetime.datetime(base_year + counter, base_month, base_day)
        counter += 1

year = increment_year()

I am not a fan of using global unless it is necessary, and it isn't in this case since a generator works just fine.


Solved with workaround. I used the sequential number function field calculator linked above to create a separate field and then just converted to date field using the Convert Time Field tool in geoprocessing.

enter image description here enter image description here Result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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