Convert seconds to compound duration: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Sidef}}: Fix link: Perl 6 --> Raku) |
m (J: minor bit of documentation on what's happening) |
||
Line 1,812: | Line 1,812: | ||
}: ;:inv ,(0 ~: seq) # (8!:0 seq) ,. <;.2'wk,d,hr,min,sec,' |
}: ;:inv ,(0 ~: seq) # (8!:0 seq) ,. <;.2'wk,d,hr,min,sec,' |
||
)</lang> |
)</lang> |
||
The first line uses integer division with remainder to break the value in seconds into its components (weeks, days, hours, minutes, seconds). |
|||
The second line gives each value a label and a trailing comma, drops the parts which correspond to zero, combines the rest and then removes the trailing comma from the end of the resulting line. |
|||
Task examples: |
Task examples: |