What is the required format for dates in Field calculator in ArcGIS 10.3.1

1630
5
Jump to solution
08-12-2019 02:42 AM
SimonCrutchley
Occasional Contributor III

This may seem like a simple question, but I'm having problems. According to the "Fundamentals of date fields" in ArcGIS 10.3.1, " a shapefile stores dates in a date field with this format: yyyy-mm-dd". However, when I put 2017-03-07 into my field, formatted as a date field, in Field Calculator, what comes out is 29/06/1905! If I just enter that into the individual field, it works fine, just not in the field calculator, and unfortunately I need to populate a number of shapefiles, each with several hundred rows.

What am I doing wrong?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

did you try

datetime.datetime(2000, 12, 31)

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

did you try

datetime.datetime(2000, 12, 31)

SimonCrutchley
Occasional Contributor III

No, but I have now, and it works

Thank you.

0 Kudos
SimonCrutchley
Occasional Contributor III

Hi Dan,

This works, but it comes out in US format (mm/dd/yyyy). Is there a way so that it works in UK (dd/mm/yyyy). I know that I can alter the display in pop-ups and the attribute table, but when I set up a query in Portal, it is asking for input in US, which could confuse my potential users.

Thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

Simon... I don't do the portal thing, and the inputs to datetime can be constructed from the individual year, month, day components, but you can't switch their order in datetime.datetime.  Display for your locale can be controlled by windows.

I only work with standardized YYYY-MM-DD format so I have little experience with localized preferences

0 Kudos
SimonCrutchley
Occasional Contributor III

Hi Dan,

Thanks anyway. At least you got my data to appear in the right century! I'll try other tacks.

0 Kudos