5

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.

  • 1
    Are you willing to use the Python parser in the field calculator? – Aaron Mar 30 '15 at 16:51
  • Thanks for your reply! To me, Python is trickier so I was hoping to avoid it completely. Unless there is a generic line of script that I could copy and paste directly into the Field Calculator, I'd prefer to stick with VB Script. Dan C's response below helped. – kpwesson Mar 30 '15 at 18:40
  • Can I see your attribute table to see how the dates are formatted? – ed.hank Feb 16 '16 at 16:20
  • Sorry, @ed.hankins, I no longer have access to this data... – kpwesson Feb 24 '16 at 17:54
10

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.