ArcGIS – Converting 12-Hour Time to 24-Hour Time Using Field Calculator in ArcGIS

arcgis-10.2arcgis-desktopfield-calculatorshapefile

Does anyone know how to convert string time formats in ArcMap v10.2 from 12-hour to 24-hour using a simple query in the Field Calculator? i.e. NO Python, NO editing in Excel, NO changing my Windows PC settings, etc…

This is a successful calculation I used (which I found on a discontinued forum) to convert my dates from MM/DD/YYYY to YYYY/MM/DD:

year([DateFld]) & "/" & Month([DateFld]) & "/" & Day([DateFld])

Perhaps there is some sort of modification that I could make to the above calculation that would change my times to 24-hour? I've searched for an answer everywhere and played around with it without any luck, but I would like for the times to be in h:mm:ss format.

Forgot to mention that this is a regular shapefile, not part of a GDB.

Best Answer

There is actually an ArcGIS tool specifically for this task: Convert Time Field. You don't even need to use the Field Calculator. Just specify the format of the source date/time field and your desired output format and the tool will create a new field and populate it with the converted values. It can be used for converting dates, times, or a combination of both.