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.
- In ArcMap, right-click the desired layer and click Open Attribute Table.
- 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.
- Start an edit session.
- Right-click one of the new fields, for example Day 2, and select Field Calculator.
VB Script Parser
- Select the VB Script Parser and set the Type to Date.
- To increment the existing data by one day, type the following expression and click OK:
[Existing date field] +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.
- Select the VB Script Parser and set the Type to Date.
- To increment Day_2 by one day, type the following expression, and click OK to view the results.
[New date field] +1
Python Parser
- Select the Python Parser and set the Type to Date.
- Type the following expression and click OK:
arcpy.time.ParseDateTimeString(![existing_field_name]!) + datetime.timedelta(days=1)
- To populate a subsequent date field, right-click the subsequent new field, for example Day_3, and select Field Calculator.
- Select the Python Script Parser and set the Type to Date.
- 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)