So I'm calculating total drive times in Network Analyst. I have an end time field that I'm trying to strip the minutes and seconds from for a new field. It's a date field formatted like so: 9/16/2019 8:01:06 AM. I enter Minute(EndTime) + ":" + Second(EndTime) in the field calculator. The issue is, I'm getting resulting times like 1:6 which should read 1:06, or one minute, six seconds. What gives??
Solved! Go to Solution.
Hi Levi Cecil ,
In addition to the correct answer provided by Lance Cole , it is important to understand that the Second function returns a number, not a text:
Second( dateValue ) -> returns:
You want to get the result in a certain format and that is obtained by using the Text function as Lance described. In this case you don't have to use the Second and Minute functions, but by providing the desired format "m:ss" or "mm:ss" (what ever suits your need most) you can use a single function. To see more formatting options, please see: Data Functions | ArcGIS for Developers
I added the extra 'm' to your original solution Text(EndTime, 'mm:ss'). A single 'm', Text(EndTime, 'm:ss') results in an empty string if the time is less than a minute.