Editing the time portion of a datetime value in a date field (geodatabase)

1215
4
Jump to solution
10-01-2014 01:56 PM
BlakeTerhune
MVP Regular Contributor

I was only able to find one other lonely soul with the same question. Since that has gone unanswered since 2011, I would like to ask the question again. I'm currently using ArcGIS Desktop in a mixed 10.0 and 10.2.2 environment.

If a geodatabase date field stores a full datetime value, how can you modify the time portion of the datetime value in ArcMap? I don't want to go through the hassle of calculating fields to display the time if the date field already has the time value buried in there somewhere.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

Well, I just tried something stupidly obvious and it seems to be the solution I was after. I just manually typed in the time I wanted after the date and it saved and displayed just fine; I used the hh:mm:ss format with AM or PM after but it looks like you can type any "standard" date or format and ArcMap will re-display it as M/D/YYYY HH:MM:SS AM/PM. I even tried oct 13, 2014 13:02:58 and it handled it just fine.

Thank you, Richard, for having me go over the whole thing again to make an example. Sometimes that's all it takes! Please post if you have anything else to add about your experience with datetime values in ArcGIS.

View solution in original post

0 Kudos
4 Replies
RichardFairhurst
MVP Honored Contributor

Give an example of what the date field currently contains and what you want it to contain.  If more than one field is involved explain how in an example.

BlakeTerhune
MVP Regular Contributor

I'll just keep it as simple as possible. Say we have a feature class with date field called "StartDate." When you create the field as a date data type and edit it in ArcMap, the Attribute Editor gives you get a handy little date picker and you choose 10/13/2014 but no place to specify a time.

Now if you open up the query builder in ArcMap, and get unique values for the StartDate field, you see the values listed as datetime like TO_DATE('2014-10-13 00:00:00','YYYY-MM-DD HH24:MI:SS')

I would like to see the full datetime value displayed in the Attribute Editor so you can change the date and the time like 10/13/2014 7:03:12 PM

EDIT:

After poking around in the SDE database, the system tables created by ArcGIS that have date fields include a time and it is displayed; like the SDE.Compress_Log table for example.

0 Kudos
BlakeTerhune
MVP Regular Contributor

Well, I just tried something stupidly obvious and it seems to be the solution I was after. I just manually typed in the time I wanted after the date and it saved and displayed just fine; I used the hh:mm:ss format with AM or PM after but it looks like you can type any "standard" date or format and ArcMap will re-display it as M/D/YYYY HH:MM:SS AM/PM. I even tried oct 13, 2014 13:02:58 and it handled it just fine.

Thank you, Richard, for having me go over the whole thing again to make an example. Sometimes that's all it takes! Please post if you have anything else to add about your experience with datetime values in ArcGIS.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

ArcGIS uses a 'struct tm' datatype to pass around SE_DATE_TYPE data.  The native datatypes which are supported for that type vary by RDBMS implementation.  If you start with zeros in the hours/minutes/seconds fields (midnight), and update using the previous year/month/day and adding the desired HH:MM:SS should work just fine. [Note that shapfiles use dBase-III date fields, which do not support second resolution timestamps.]

- V