CSV input not including time with date

244
1
03-01-2022 04:20 PM
ccowin_odfw
Occasional Contributor

Hello,

I have big script (in a python toolbox) that can take in GPS Collar data from several manufacturers and spits out a feature class for review before it is added to the main database. One of the manufacturers outputs their data in a csv. So I'm just doing a table to table conversion and then going through the rest of the script. The issue is that only the date is coming through and leaving the time for some reason. I don't think it would be too onerous to split up the column in the csv before it was imported (I have another CSV but their date and time come separated and I combine them into 1), but it seems like this shouldn't be a problem in the first place as I'm using a field calculator to just input the entire column into the feature class:

arcpy.management.CalculateField(output_path, 'UTC',
expression='!Date___Tim!',
expression_type='PYTHON 3',
code_block="""""",
field_type='DATE'
)

Also tried converting it to a string, but it seems to be losing the time when the CSV is converted to the table, but I have no idea why that would be.

The format in the CSV is:

%m/%d/%Y %H:%M:%S

 Thanks!

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

a related thread with some suggestions

Solved: Create DateTime from separate Date and Time fields - Esri Community


... sort of retired...
0 Kudos