Hi all,
I need to convert date & time text field in a date field.
The input is like that: "11-05-2023 08:26:01.953".
Using the "Convert Time Field" tool with the input time format option in milliseconds (dd-MM-yyyy hh:mm:ss.s) the output in the new converted field is 11/05/2023 08:26:01 with no milliseconds.
I've read that this was a bug, but some years ago....
I've also tryed to create a new date field to store just time, settimg the format like this:
As you can see the milliseconds seem to be correctly set....
I use ArcGIS Pro 3.1.0
Any news or idea on how to do that? Thanks
Solved! Go to Solution.
Convert Time Field indeed seems to ignore milliseconds.
Instead, you can use Calculate Field with this Python expression:
datetime.datetime.strptime(!TextField1!, "%d-%m-%Y %H:%M:%S.%f")
(Replace "TextField1" with the name of your text field, take care that the name is surrounded by exclamation marks)
Here's a quick test of the Converted vs. the Calculated dates (after I set the Date format for both fields):
Convert Time Field indeed seems to ignore milliseconds.
Instead, you can use Calculate Field with this Python expression:
datetime.datetime.strptime(!TextField1!, "%d-%m-%Y %H:%M:%S.%f")
(Replace "TextField1" with the name of your text field, take care that the name is surrounded by exclamation marks)
Here's a quick test of the Converted vs. the Calculated dates (after I set the Date format for both fields):