Select to view content in your preferred language

Arcpy da insertcursor and date time fields

4686
2
Jump to solution
10-19-2016 02:14 PM
DeanMcGowan
Deactivated User

i need to add new rows to a table in a file geodatabase using python (da.insertcursor). One of the fields that I am  adding data to is a datetime. The insert operation functions correctly except for the fact that the time component is always omitted in the resulting datetime firks. I understand that shape files only store dates but that this doesn't apply to file geodatabases. I verified this by manually adding an entry in ArcGIS with a time component; this worked fine. I have checked the datetime variable that I create and pass in python and it includes all data as expected. Has anyone else had trouble with this? Is there a workaround?

0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Honored Contributor

There is a working example in this thread. The main trick is to use datetime.datetime.strptime(), but it sounds like you've already correctly made a datetime object. Can you post the relevant code?

View solution in original post

2 Replies
DarrenWiens2
MVP Honored Contributor

There is a working example in this thread. The main trick is to use datetime.datetime.strptime(), but it sounds like you've already correctly made a datetime object. Can you post the relevant code?

DeanMcGowan
Deactivated User

Thanks for the quick help. Using the link you posted I was able to get things running! Now I just have to wait while 72mil rows are added...

0 Kudos