Skip To Content

Calculate End Time


Calculates the end time of features based on the time values stored in another field.

End Time Field values are calculated using the time values from the Start Time Field. The end time value for a record is equal to the start time of the next record. For the last record in the table, the end time will be equal to the start time.


  • The table is first sorted by the fields in the ID Fields parameter, then by the Start Time Field. After this sort, the end time of any row is the same as the start time of the next row.

  • The End Time Field value for the last row will be the same as the Start Time Field value for that row.


CalculateEndTime_management (in_table, start_field, end_field, {fields})
ParameterExplanationData Type

The feature class or table for which an End Time Field is calculated based on the Start Time Field specified.

Table View

The field containing values that will be used to calculate values for the End Time Field. The Start Time Field and the End Time Field must be of the same type. For example, if the Start Time Field is of type LONG, the End Time Field should be of type LONG as well.


The field that will be populated with values based on the Start Time Field specified. The Start Time Field and the End Time Field must be of the same format.


The name of the field or fields that can be used to uniquely identify spatial entities. These fields are used to first sort based on entity type if there is more than one entity. For instance, for a feature class representing population values per state over time, the state name could be the unique value field (the entity). If population figures are per county, you would need to set the county name and state name as the unique value fields, since some county names are the same for different states. If there is only one entity, this parameter can be ignored.


Code sample

CalculateEndTime example (Python window)

The following Python window script demonstrates how to use the CalculateEndTime tool in immediate mode.

import arcpy
CalculateEndTime example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the CalculateEndTime tool.

# Name:
# Description: Calculate end time based on a start time field
# Requirements: None

# Import system modules
import arcpy

# Set local variables
inTable = "C:/Data/TemporalData.gdb/CalculateEndTime"
uniqueIdFields = ""
startTimeField = "Start_Time"
endTimeField = "End_Time"
# Execute CalculateEndDate
arcpy.CalculateEndTime_management(inTable, startTimeField, endTimeField, uniqueIdFields)


Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics