English

How To: Populate subsequent date fields in an attribute table based on a date using the Field Calculator in ArcMap

Summary

In some instances, more than one date field is required in an attribute table. Separate date fields may be used to keep track on important dates for weather reports and data collections, for example.

Procedure

The instructions below describe how to populate subsequent date fields in an attribute table based on an existing date using the Field Calculator in ArcMap. The subsequent date fields can be populated using a VB Script parser or a Python parser.

  1. In ArcMap, right-click the desired layer and click Open Attribute Table.
Attribute table
 
  1. Add the number of new fields with Date type according to the number of dates required. The image below shows an example of two new fields added to the attribute table, Day_2 and Day_3.
New fields
  1. Start an edit session.
  2. Right-click one of the new fields, for example Day 2, and select Field Calculator.
VB Script Parser
  1. Select the VB Script Parser and set the Type to Date.
  2. To increment the existing data by one day, type the following expression and click OK:
[Existing date field] +1
Expression to determine the next date
  1. To populate a subsequent date field, right-click the subsequent new field, for example Day_3, and select Field Calculator. Click OK to view the results.
  2. Select the VB Script Parser and set the Type to Date.
  3. To increment Day_2 by one day, type the following expression, and click OK to view the results.
[New date field] +1
Expression to determine the succeding date field
Python Parser
  1. Select the Python Parser and set the Type to Date.
  2. Type the following expression and click OK:
arcpy.time.ParseDateTimeString(![existing_field_name]!) + datetime.timedelta(days=1)
Python expression to determine the next date
  1. To populate a subsequent date field, right-click the subsequent new field, for example Day_3, and select Field Calculator.
  2. Select the Python Script Parser and set the Type to Date.
  3. To increment Day_2 by one day, type the following expression, and click OK to view the results.
arcpy.time.ParseDateTimeString(!new_field_name]!) + datetime.timedelta(days=1)
Python expression to determine the succeeding date field
 
Results

Related Information