Convert seconds to compound duration: Difference between revisions

Add APL
(Add APL)
Line 291:
9 wk, 6 d, 10 hr, 40 min
</pre>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
<lang APL>duration←{
names←'wk' 'd' 'hr' 'min' 'sec'
parts←0 7 24 60 60⊤⍵
fmt←⍕¨(parts≠0)/parts,¨names
¯2↓∊fmt,¨⊂', '
}</lang>
{{out}}
<pre> duration 7259
2 hr, 59 sec
duration 86400
1 d
duration 6000000
9 wk, 6 d, 10 hr, 40 min</pre>
 
=={{header|AppleScript}}==
2,095

edits