Many feature layers store date and time (temporal) information. The date and time might represent when a feature was in a specific location or when a feature was first observed in the real world. Or the date and time might relate to other nonspatial attributes in the layer, such as when a property was sold, the last time a sample was taken from a specific water body, or the date and time a fire engine was dispatched from a specific fire station.
Temporal data is stored in the following date and time fields in ArcGIS Online, though functionality varies by type. To correctly add, edit, or interpret date and time values in hosted feature layers, it is important to understand how they are stored and displayed in ArcGIS Online. Use the links to access information about formatting and storage for each type.
Date fields
Date fields can store date (day, month, and year) and time values in local time with up to millisecond precision.
Use a date field to store data that requires date and time values if the time values are all in the same time zone. Examples include the following:
- City construction site inspections
- Date and time of births across a county per hospital
- Any date and time value stored in one time zone that is converted to local time when viewed, based on the locale set for the viewing app
Input format for date values
If you calculate a date field's values to populate the field or query the field, dates must be typed in MM/DD/YYYY hh:mm:ss format, enclosed in single quotation marks. For example, to set a date field to 5:00 p.m. on May 27, 2014, you would type '05/27/2014 05:00:00PM', '05/27/2014 5:00PM', or '05/27/2014 17:00:00' (24-hour clock). Storing time alone is not supported—time must always be a component of a date. If you do not provide a time, the time defaults to 12:00 a.m.
When you calculate date and time values in a hosted feature layer using the SQL standard date functions, you must provide the time in UTC. When the calculated value is displayed in the table, it will show in local time. For example, if your local time is PST and you type '05/27/2014 12:23:00 PM' as a value when calculating, the value in the calculated fields will display with a time conversion based on your computer time. In this example, the calculated value will display as '05/27/2014 05:23:00 AM'.
Storage of date values for hosted feature layers
Date values in hosted feature layers are stored in coordinated universal time (abbreviated UTC) in the ArcGIS Online feature data store. UTC is nearly equivalent to the current time at Earth's prime meridian (zero degrees longitude), located near Greenwich, England, but UTC is a more precise version of GMT (Greenwich mean time).
When you publish feature layers containing date fields from files, ArcGIS Pro, or an ArcGIS Desktop app, and if the date fields contain local time zone values, you must specify that the date values are in the local time zone when you publish the layer. This enables the publishing process to transform the local time data into UTC for storage in the database.
Dates are converted to UTC when they're stored because the physical location of the server hosting the data and the people viewing the maps that contain the data can be anywhere in the world. Storing the time in UTC allows ArcGIS Online to transform the data to the correct local time zone regardless of the location of the server or the viewer of the application.
How date fields are displayed
Values will appear correctly in your local time when you view them in ArcGIS Online.
The client you use to view the data determines how date and time values are displayed. When a date field is displayed in ArcGIS Online, the date is converted from UTC to your local time or in the time zone offset you chose when you published the layer. For local time, ArcGIS Online queries your computer's time zone setting. For example, suppose your computer is set to Pacific standard time (PST). PST is eight hours behind UTC—when UTC is 9:00 a.m, it is 1:00 a.m. PST. When daylight saving time is in effect, your local time is Pacific daylight time (PDT), which is seven hours behind UTC, so the value will be converted to 2:00 a.m. when displayed in the layer's item page or preview in ArcGIS Online. If you chose a time zone offset for the layer, values display in that time zone in Map Viewer.
Formatting is shared for tables and pop-ups in Map Viewer. To change how date field values display, alter the field configuration.
Date formats in files used to publish hosted feature layers
When you add files such as Microsoft Excel, Google Sheets, comma-separated values (CSV), or other delimited text files and publish, ArcGIS Online recognizes the formats in the table below as date fields.
Format | Example |
---|---|
M/DD/YYYY | 7/28/2009 |
M/DD/YYYY 12-hour time | 7/28/2009 5:23 AM or 7/28/2009 05:23 AM |
M/DD/YY | 7/28/09 |
M/DD/YY 12-hour time | 7/28/09 5:23 PM or 7/28/09 05:23 PM |
MM/DD/YY | 07/28/09 |
MM/DD/YY 12-hour time | 07/28/09 5:23 PM or 07/28/09 05:23 PM |
MM/DD/YYYY | 07/28/2009 |
MM/DD/YYYY 12-hour time | 07/28/2009 5:23 PM or 7/28/2009 05:23 PM |
Month DD | July 28 |
YYYY/MM | 2009/07 |
YYYY-MM | 2009-07 |
YYYY/MM/DD | 2009/07/28 |
YYYY/MM/DD hh:mm:ss | 2009/07/28 17:23:00 |
YYYY-MM-DD hh:mm:ss | 2009-07-28 17:23:00 |
YYYY/MM/DD hh:mm:ss.s | 2009/07/28 17:23:00.5 |
YYYY-MM-DDThh:mm:ss.s | 2009-07-28T17:23:00.5 |
Date formats in files added directly to Map Viewer Classic
If you add a file to My content and do not publish a feature layer from it, there are no restrictions on the format used for date values in the file.
However, when you add CSV or text files directly to a map, ArcGIS Online recognizes only the date formats described in the following tables.
Adding CSV and text files directly to the map is only supported in Map Viewer Classic.
If you add a .csv file directly to Map Viewer Classic, the following date formats are loaded as dates, but times do not appear in the table in Map Viewer Classic:
Format | Example input | Table value |
---|---|---|
M/DD/YYYY 12-hour time | 7/28/2009 5:23 PM | July 28, 2009 |
MM/DD/YYYY 12-hour time | 07/28/2009 5:23 PM | July 28, 2009 |
M/DD/YY 12-hour time | 7/28/09 5:23 PM | July 28, 2009 |
MM/DD/YY 12-hour time | 07/28/09 5:23 PM | July 28, 2009 |
When you add a .txt file to Map Viewer Classic, the following date formats are recognized as date fields:
Format | Example input | Table value |
---|---|---|
M/DD/YYYY 12-hour time | 7/28/2009 5:23 PM | July 28, 2009 |
MM/DD/YYYY 12-hour time | 07/28/2009 5:23 PM | July 28, 2009 |
MM/DD/YY 12-hour time | 07/28/09 5:23 PM | July 28, 2009 |
Day of week, Month DD, YYYY 12-hour time* | Tuesday, July 28, 2009 5:23 PM | July 28, 2009 |
Month DD, YYYY 12-hour time* | July 28, 2009 5:23 PM | July 28, 2009 |
*These date formats are only supported if you delimit fields using tabs or a semicolon.
Date only fields
Date only fields can store date values of day, month, and year. No time values are stored for date only fields.
Use a date only field to store data that was captured in the granularity of days—such as historical journal entries—or attribute values that apply to, or represent, the entire day such as the following:
- Hire date for each employee
- Book publishing date
- Copyright expiration date
Input format for date only fields
The client from which you type the values will determine the input format.
In Map Viewer and most other places in ArcGIS Online, the tool or interface you use will provide you with calendar modals and formatting checks if you type a value.
When editing in the table on the Data tab of the hosted feature layer's item page, you can type values in the format YYYY-MM-DD. For example, type 2023-10-06 to store the value for October 6, 2023.
Storage of date only values for hosted feature layers
When you add a date only field to a hosted feature layer or create an empty hosted feature layer with a date only field, the field is stored as a date only field in the ArcGIS Online feature data store. If you add a date only field from the Data tab of the hosted feature layer's item page, the field is stored as a string field in the ArcGIS Online feature data store.
How date only fields are displayed
The clients you use to consume the hosted feature layer may allow you to change how date only fields are displayed.
Formatting is shared for tables and pop-ups in Map Viewer. To change how date only field values display, alter the field configuration.
Date only formats in files used to publish hosted feature layers
If the values are in DD/MM/YYYY or YYYY-MM-DD format when publishing from a .csv, Excel, or GeoJSON file, the default field type is date only. If the format meets one of the formats listed for a date field, it will publish as a date field by default. All other formats will likely default to a string field in the resultant hosted feature layer.
When published from a zipped file geodatabase, service definition file, or ArcGIS Pro, the date only fields will be preserved as date only fields.
Time only fields
Time only fields can store time values in local time with millisecond precision. No date values are stored.
Use a time only field to store data that repeats daily or content for which only the time component matters, such as for the following:
- Store hours
- Local bus schedules
You could also have a time only field separate from a date only field to make time calculations for short duration occurrences easier. For example, if you record when an order is submitted at a drive-through and when the order is completed, you can calculate the time difference between the two events without having to parse the values in a date or timestamp offset field.
Input format for time only fields
The client from which you type the values will determine the input format.
In Map Viewer and most other places in ArcGIS Online, the tool or interface you use will provide you with drop-down menus and formatting checks if you type a value.
When editing in the table on the Data tab of the hosted feature layer's item page, you can type values in the format hh:mm:ss.s. For example, type 16:12:08.4 to store the value for 4:12 p.m. and 8.4 seconds.
Tip:
You can store seconds and milliseconds in these fields, but milliseconds will not display in ArcGIS Online. However, when you export the data, milliseconds will be present in the export file if the file type supports them.
Storage of time only values for hosted feature layers
When you add a time only field to a hosted feature layer or create an empty hosted feature layer with a time only field, the field is stored as a time only field in the ArcGIS Online feature data store. If you add a time only field from the Data tab of the hosted feature layer's item page, the field is stored as a string field in the ArcGIS Online feature data store.
How time only fields are displayed
The clients you use to consume the hosted feature layer may allow you to change how time only fields are displayed.
Because they are actually string fields, the values do not change to reflect local time or any time offsets set on the feature layer.
Formatting is shared for tables and pop-ups in Map Viewer. To change how time only field values display, alter the field configuration.
Time only formats in files used to publish hosted feature layers
If the values in the source .csv, Excel, or GeoJSON file are in the format hh:mm:ss or hh:mm:ss.sss, the default field type will be time only when you publish.
If the format meets the time portion of the supported formats for a date, the default type will be a date field. However, it is not recommended that you publish time only values as date fields, because ArcGIS Online will insert today's date (based on the time zone offset you choose when publishing or UTC), which will change the time values. To preserve the time values as stored in the source file, map the field to a string when publishing.
When published from a zipped file geodatabase, service definition file, or ArcGIS Pro, the time only fields will be preserved as time only fields.
Timestamp offset fields
Timestamp offset fields can store date and time values. The time values include information about the time offset from coordinated universal time (UTC).
The time offset from UTC unambiguously identifies a single point in time, but it does not unambiguously identify a time zone. Offset from UTC is only one characteristic of a time zone; it changes if the time zone observes daylight saving time, and multiple time zones share the same offset from UTC.
Use a timestamp offset field for data for which the local time value is important and the dates can cross multiple time zones, such as for the following types of data:
- Recording natural disasters across the world
- Airline departures and arrivals
- Tracking product shipments
Input format for timestamp offset fields
The client from which you type the values will determine the input format.
In Map Viewer and most other places in ArcGIS Online, the tool or interface you use will provide you with drop-down menus, calendar modals, and formatting checks if you type a value.
When editing in the table on the Data tab of the hosted feature layer's item page, you can type values in the format YYYY-MM-DDThh:mm:ss±OffsetFromUTC. For example, type 2023-10-06T16:12:08+01:00 to store the value for 4:12 p.m. and 8 seconds on October 6, 2023 in Central European time.
Storage of timestamp offset values for hosted feature layers
If the format of the values in the source file is YYYY-MM-DDThh:mm:ss±OffsetFromUTC, the field type will default to the timestamp offset field type and be stored as such in the ArcGIS Online feature data store.
How timestamp offset fields are displayed
The clients you use to consume the hosted feature layer may allow you to change how timestamp offset fields are displayed.
Formatting is shared for tables and pop-ups in Map Viewer. To change how timestamp offset field values display, alter the field configuration.