javascript: smallest code to convert seconds to time Given seconds like 11728, write the smallest javascript function that returns a string like 3hrs. 15min. 28sec.

signature textTime([int] t,[bool] z,[bool] m)

t is the time like 11728 and you can assume int
z is optional and true means drop zero times, so 3hrs. 0min. 28sec. becomes 3hrs. 28sec.
m is optional and true means show only up to minutes, so 3hrs. 16min. 48sec. is 3hrs. 16min.  

For 1 hour, 1hrs. is fine (vs 1hr.)

Example:

textTime(11728) returns "3hrs. 0min. 28sec."
textTime(11728,true) returns "3hrs. 28sec."
textTime(11728,true,true) returns "3hrs."


Regex is fine, speed is inconsequential.

Shortest code wins.
155 147 characters.

textTime=(t,z,m,x)=&gt;(x=[t/3600,t/60%60,t%60].map((t,i)=&gt;(!z||t|0)&amp;&amp;~~t+["hrs","min","sec"][i]+"."||0).slice(0,2+!m),(z?x.filter(x=&gt;x):x).join(" "))


If the parameters made a little more sense, yes, it would be fewer.

Non-ES6, changing the name and using globals like @C5H8NNaO4 did, at 183 characters:

function t(t,z,m){return(x=[t/3600,t/60%60,t%60].map(function(t,i){return(!z||t|0)&amp;&amp;~~t+["hrs","min","sec"][i]+"."||0}).slice(0,2+!m),(z?x.filter(function(x){return x}):x).join(" "))}