ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Fundamentals of date fields

  • Displaying dates
  • Calculating date fields
  • Entering values for date fields

Date fields vary between data source types, and their display depends on your system locale. Whether you're displaying, calculating, or selecting date attributes, you must determine the appropriate way to work with date fields in your database.

Selecting and displaying date field values on the Select by Attributes and similar query building dialog boxes is done using a SQL syntax that will vary depending on the underlying database or data format. This is described in detail in the SQL reference topic.

Calculating and displaying date fields in the attribute table is done in a different format and syntax. This is because the field calculator in ArcMap uses Python and VBScript functions and the display format depends on the system, not the database. This topic only describes working with date fields in the attributes table and using the Calculate Field geoprocessing tool (launched from the Field Calculator command from the attribute table).

Displaying dates

A coverage or shapefile stores dates in a date field with this format: yyyy-mm-dd. A geodatabase formats the date as datetime yyyy-mm-dd hh:mm:ss AM or PM. Settings on your Windows system determine how the dates are displayed in ArcMap—M/d/yy, MM/dd/yy, yy/MM/dd, and so on. ArcMap uses the system short date format (numerical) for displaying dates. If you need to change how ArcMap displays date formats, you can access the Region and Language settings through your system's Control Panel.

Note:

Region and Language dialog box settings may vary depending on your Windows operating system. The ArcGIS 10.3.x for Desktop system requirements provides a list of the supported operating systems.

Calculating date fields

When calculating date fields, the field calculator in ArcMap can use Python and VBScript datetime functions. Some of the functions support datetime yyyy-mm-dd hh:mm:ss AM or PM. However, for coverages and shapefiles, the time portion is truncated from the datetime value. For example, the datetime 2002-08-20 12:00:00 PM is stored in a coverage or shapefile as 2002-08-20.

Any Python datetime function can be used to calculate a date. If you want to calculate an attribute equal to current time, you can use the today() function.

You can also use two digits for the year value when calculating dates. When you calculate a date such as date_field = dateserial(02,8,20) and specify two digits for the year (02 in this case), your system's settings control which century is used. This setting can be adjusted through Regional Options on Windows systems.

Entering values for date fields

The format for date fields in ArcMap is mm/dd/yyyy hh:mm:ss and a specification of AM or PM. You can enter all or part of the date or time. For example, all of the following are acceptable inputs:

  • 1/31/2000
  • January 31 2000
  • January 31, 2000
  • 1/31—The current year is automatically appended to the value
  • 1:00:00 PM
  • 1:00:00—AM is automatically appended to the value

You can also use Python or VB script:

  • Python example—time.strftime('31/1/2000')
  • VB script example—cdate("1/31/2000") or cdate(#1/31/2000#)

Related topics

  • ...displays short format dates on Windows 7
  • ArcGIS field data types

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2018 Esri. | Privacy | Legal