Skip to content

Instantly share code, notes, and snippets.

@danmaps
Last active April 4, 2016 15:04
Show Gist options
  • Save danmaps/c7b0a6ad37b19d81d8da to your computer and use it in GitHub Desktop.
Save danmaps/c7b0a6ad37b19d81d8da to your computer and use it in GitHub Desktop.
Iterate Date Field in Field Calculator
license: gpl-3.0

Field Calculator code block:

delta = 0
def autoIncrement():
  global delta # Needed to modify global copy of delta
  deltadate= datetime.datetime(1980, 1, 1) + datetime.timedelta(days=delta )
  delta += 1
  return deltadate

Expression:

autoIncrement()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment