4 Replies Latest reply on Apr 15, 2011 5:59 AM by jungovox

# Convert seconds to hours and Minutes (not decimal hours)

### Title

Convert seconds to hours and Minutes (not decimal hours)

### Post

I have the rusult of subtracking one timestamp from another (like right now minus a TS from just a bit over 2 days ago) - the difference is seconds -

Example (seconds)

178911

I need to get hours and minutes

and not 49.69 hours (result/60)/60

thoughts ?

• ###### 1. Re: Convert seconds to hours and Minutes (not decimal hours)

Choose Time as your return type. On your layout, use hhmm as your data format (or choose hhmmss if you want).

• ###### 2. Re: Convert seconds to hours and Minutes (not decimal hours)

Thanks Phil - that was the inspiration I needed - my problem was NOT choosing 24 hours for the formating -

what if I wanted return days Hours min ?

• ###### 3. Re: Convert seconds to hours and Minutes (not decimal hours)

Then you'd need to craft your own calculation to separate out the days.

There are 86400 seconds in a day, 3600 in an hour, 60 in a minute. Ts1 and Ts2 are your two time stamp fields.

Let ( [ I = Ts2 - Ts1 ;
D = Div ( I ; 86400 ) ;
H = Div ( Mod ( I ; 86400 ) ; 3600 ) ;
M = Round ( ( I - ( D * 86400 ) - ( H * 3600 ) ) / 60 ; 0 ) ]
D & " Days " & H & " hours " & M & " minutes"
)

• ###### 4. Re: Convert seconds to hours and Minutes (not decimal hours)

Brilliant - thank yu Phil