Arcpy da insertcursor and date time fields

2593
2
Jump to solution
10-19-2016 02:14 PM
Highlighted
New Contributor II

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?

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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
Highlighted
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

Highlighted
New Contributor II

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...

Reply
0 Kudos