HOW TO

Copy isodatetime values in a string field to date values in a date field

Last Published: April 25, 2020

Summary

This article demonstrates how to use the Field Calculator to copy isodatetime values in a table's string field to date values in a date field.

Procedure

The 'Hiredate' field represents the string field with the isodatetime values and the 'NewDate' field represents the date defined field with the date values.

  1. Open the table in ArcView.

    A. Activate the Project window.
    B. Click the Tables icon.
    C. Click the Add button.
    D. Set List Files of Type to appropriate file type.
    E. Navigate to the location of the table.
    F. Select the table.
    G. Click OK.

  2. Add a date field to the table.

    A. Select Start Editing from the Table menu.
    B. Select Add Field from the Edit menu.
    C. In the Field Definition dialog box:
    1. Set Name to an appropriate name, for example 'Date'.
    2. Set Type to Date.
    D. Click OK.
    E. Select Stop Editing from the Table menu and save the edits.

  3. Activate the string field with the isodatetime values.
    [O-Image] isodatetime active
  4. Enter the following code into the expression text box on the Field Calculator dialog box and click OK.

    Code:
    [Hiredate].Extract(0).Substitute( "-", "")


    Note:
    Hiredate is the name of the string field containing the isodatetime values.


    [O-Image]isodatetime field calculator
  5. Make the new date field active.
    [O-Image] isodatetime new date values
  6. Enter the following code into the expression text box on the Field Calculator dialog box and click OK.

    Code:
    [Hiredate].AsNumber.AsDate

    [O-Image] isodatetime field calculator new date

    [O-Image] isodatetime new date values

Article ID:000005034

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic