madman411 Posted October 3, 2014 Posted October 3, 2014 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!
madman411 Posted October 3, 2014 Author Posted October 3, 2014 I seem to have got it working using: ttimein / 3600 Still interested in the latter portion of my original post though.
comment Posted October 3, 2014 Posted October 3, 2014 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 )
Recommended Posts
This topic is 3761 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now