Summary
Adding a current date to the output layer name enables users to generate daily layers and keep track of updated data. In ModelBuilder, the output layer name generated automatically contains the current date.
Procedure
The instructions provided describe how to export layers with a current date in the output layer name using ModelBuilder in ArcMap and ArcGIS Pro:
In ArcMap
- In ModelBuilder, add the Calculate Value function by clicking Insert > Model Only Tools > Calculate Value.
- In the Calculate Value dialog box, add the following expression:
time.strftime("<LayerName>%Y%m%d")
- In the Calculate Value dialog box, change the Data type parameter to String.
- Type the %<output parameter name>% in the Output Feature Class section of the tool used.
Note:
Ensure the output parameter name is exactly the same as the Calculate Value tool output name. In this example, the output name of the Calculate Value tool is output_value. Therefore, the output parameter name in the Output Feature Class section must be %output_value%.
- Click Connect
and link the output from Calculate Value to the selected geoprocessing tool, and select Precondition.
- Validate and run the model. The output layer name with the current date is located in the selected location.
In ArcGIS Pro
- On the ModelBuilder tab on the top ribbon, add the Calculate Value function by clicking Utilities > Calculate Value.
- In the Calculate Value dialog box, add the following expression:
time.strftime("<LayerName>%Y%m%d")
- In the Calculate Value dialog box, change the Data type parameter to String.
- In the Model window, double-click the geoprocessing tool used, and type %<output parameter name>% in the Output Feature Class section.
Note:
Ensure the output parameter name is exactly the same as the Calculate Value tool output name. In this example, the output name of the Calculate Value tool is output_value. Therefore, the output parameter name in the Output Feature Class section must be %output_value%.
- Click the output of Calculate Value, and link it to the selected geoprocessing tool. Select Precondition.
- Validate and run the model. The output layer name with the current date is located in the selected location.