Help with Datetime Format

755
4
10-24-2013 02:13 PM
NickJacob
New Contributor II
Hello,

I'm having a difficult time importing some .csv files into a file geodatabase and any advice would be greatly appreciated.  The files I'm having trouble with contain a field with timestamps formatted as mm/dd/yyyy hh:mm (ex 10/13/2013 18:34).  When adding the file to ArcMap via the Add Data button I can see the values just fine, however if I try to import the file through a python script the resulting field contains <Null> values.  So far I have tried the following without success:

CopyRows_management()
TableToTable_conversion()
MakeTableView_management()

Any suggestions?

Thanks!
Nick
Tags (2)
0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Nick,

What version of ArcGIS Desktop are you using?  I could not reproduce this with 10.2.  Have you tried simply import the table outside of a script?  For example, right-click on the File Geodatabase > Import > Table (single).
0 Kudos
NickJacob
New Contributor II
Thank you for replying Jake!

I'm using ArcGIS for Desktop 10.2 and manually importing does work.  The catch is that I have a python script that runs overnight and I'm not around to work with the .csv file by hand.  After getting the table into my scratch gdb, the field looks like this:

| Timestamp |
--------------
<Null>
<Null>
<Null>
<Null>

I'm sure I'm missing something simple with ArcPy... just haven't figured it out yet.  Reworking the file via the csv module seems like an option, but also seems overkill.  Any other thoughts?

- Nick
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Can you post the script you are running?
0 Kudos
NickJacob
New Contributor II
Big thanks to both JSkinn3 and davidisraelitt,

Using a FieldMappings object worked really well.  I have avoided them in the past, but now that I have a better grasp of what they can do, I can really see the benefit.
0 Kudos