English

How To: Export layers with a current date in the output layer name in ModelBuilder

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
  1. In ModelBuilder, add the Calculate Value function by clicking Insert > Model Only Tools > Calculate Value.

    Calculate Value function in ModelBuilder
     
  2. In the Calculate Value dialog box, add the following expression:
    time.strftime("<LayerName>%Y%m%d")
  3. Change the Data type parameter to String.

    Calculate Value expression.
     
  4. Add the &<output parameter name>% in the output feature class name field of the tool used.

    Add %output_value% in the output name
     
  5. Click Connect The Connect button. and link the output from Calculate Value to the selected geoprocessing tool, and select Precondition.

    Connect and select Precondition.
     
  6. Validate and run the model. The output layer name with the current date is located in the selected location.

    Example of the model

    output layer name.
In ArcGIS Pro
  1. In ModelBuilder, add the Calculate Value function by clicking Utilities > Calculate Value.

    Click Utilities and click Calculate Value.
     
  2. In the Calculate Value dialog box, add the following expression:
    time.strftime("<LayerName>%Y%m%d")
  3. Change the Data type parameter to String.
  4. Double-click the geoprocessing tool used and add the &<output parameter name>% in the output feature class name field.

    Rename output name
     
  5. Click the output of Calculate Value and link it to the selected geoprocessing tool. Select Precondition.

    Click the output and select Preconditional.
     
  6. Validate and run the model. The output layer name with the current date is located in the selected location.

    ArcGIS Pro ModelBuilder

    ArcGIS Pro output name.
     

Related Information