October 3, 201411 yr Hi all I'm attempting to have a traditional time field (ttimein & ttimeout) hh:mm converted to a decimal figure and have the total hours calculated in the decimal format. ttimein would be converted into field dtimein, ttimeout = dtimeout, and ttimetotal = dtimetotal. I'm struggling with the math that would create this conversion (no doubt in my mind it's more simple than I'm thinking). For those unfamiliar: 20:10 would be 20.17 9:22 would be 9.37 23:57 would be 23.95 etc. Some hours would extend past midnight (i.e. start at 16:00 and end at 02:00). I would also be interested in how this could be reversed -- decimal time reverted to traditional time. Thanks!
October 3, 201411 yr Author I seem to have got it working using: ttimein / 3600 Still interested in the latter portion of my original post though.
October 3, 201411 yr Try = Timefield / 3600 Result is Number, of course. Some hours would extend past midnight (i.e. start at 16:00 and end at 02:00). In such case, you need to add 24 hours to the end time, either before or after the conversion to decimal hours - for example = ( EndTime - StartTime ) / 3600 + 24 * ( StartTime > EndTime ) I would also be interested in how this could be reversed -- decimal time reverted to traditional time. Naturally, you need to multiply by 3600 to get the original value back. If the calculation field's result type is NOT time, use = GetAsTime ( DecimalHours * 3600 )
Create an account or sign in to comment