Converting Decimal minutes (time) to mm:ss

3973
4
03-18-2014 12:12 PM
PaulMorgan
New Contributor
I am trying to figure out a way inside ArcGIS to convert the OD Cost matrix field "Total_TravelTime" from decimal minutes into the mm:ss format.  In the past I've pulled the data out and into Excel and done it there using the ="Minutes" formula.  But would love to cut out that step if it can be done with python or some sql coding.
Tags (2)
0 Kudos
4 Replies
MelindaMorang
Esri Regular Contributor
You can export the Lines to a feature class, add a text field for the formatted time, and then use the Calculate Field tool from ArcToolbox to put the time into the format you want.  The Calculate Field tool allows you to use a code block where you can define a function that formats the time however you want.  See http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000 for some examples of using the code block.
0 Kudos
PaulMorgan
New Contributor
Thanks for your help Melinda--
I am trying to do a Calculate Field function, but not being a "code" person, am trying to figure that piece out.  Just trying to format the decimal value of 1.5 to look like 1:30.  Will keep searching or just export to Excel.
0 Kudos
RobertBorchert
Frequent Contributor III
What is the code you use in Excel?

Thanks for your help Melinda--
I am trying to do a Calculate Field function, but not being a "code" person, am trying to figure that piece out.  Just trying to format the decimal value of 1.5 to look like 1:30.  Will keep searching or just export to Excel.
0 Kudos
RobertBorchert
Frequent Contributor III
Create a new field and give it the DATE property

Field Calculate the new field with <decimal time field> / 24

It will automatically format it to HH:MM:SS
0 Kudos