Skip to main content
Made title more concise
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

In an arcpy script, how do I convert Converting ArcGIS date value to a string reading in mm/dd/yyyy format using ArcPy?

Tweeted twitter.com/#!/StackGIS/status/101180922631692288
Source Link
celticflute
  • 1.6k
  • 1
  • 19
  • 26

In an arcpy script, how do I convert ArcGIS date value to a string reading in mm/dd/yyyy format?

I am writing an arcpy tool script in ArcGIS 10.0. In a fGDB feature class, I have a Date type field. I gather that the values in the Date field are stored as long integer dates, but they display in mm/dd/yyy format in the table. What I want to do is capture the integer date value as a string showing the date in mm/dd/yyyy format. How do I go about this?

There are many examples of how to convert a date/time string to a date object/value but not vice versa. I am appending features from a feature class with many fields, including a date field, into a standard-schema fc (which I can't change) that has few fields. To save a lot of the technical attributes in the input, I must dump it all into a catch-all, user-controlled text field that is defined in the target. The date data from the input is one of those pieces of data I need to save, hence the need to convert the date to a string.

There is likely a fairly easy solution I'm missing, but at the moment I am at a loss. I appreciate any help that comes my way.