Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

3 added 131 characters in body

# APL+WIN, 8888 119 bytes

Original version missed out weeks and months as pointed out by Phil H;(

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365a←⌽<\⌽1≤b←⎕÷×\1 2460 60 60⊤⎕⋄b24 7,(31÷7),365÷31⋄b,(-b=1(b←⌊a/b)=1)↓∊a/'years''seconds' 'days''minutes' 'hours' 'minutes''days' 'seconds''weeks' 'months' 'years'


Explanation

1E10 365b←⎕÷×\1 2460 60 60⊤⎕24 7,(31÷7),365÷31 prompts for input and converts to years, days, hours, minutes, seconds

b←(a←<\0<b)a←⌽<\⌽1≤b identify largest unit of time and assign it to ba

a/'years' 'days' 'hours' 'minutes' 'seconds' select time unit

(-b=1(b←⌊a/b)=1)↓∊ determine if singular if so drop final s in time unit

b, concatenate number of units to time unit from previous two steps


# APL+WIN, 88 bytes

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365 24 60 60⊤⎕⋄b,(-b=1)↓∊a/'years' 'days' 'hours' 'minutes' 'seconds'


Explanation

1E10 365 24 60 60⊤⎕ prompts for input and converts to years, days, hours, minutes, seconds

b←(a←<\0<b) identify largest unit of time and assign it to b

a/'years' 'days' 'hours' 'minutes' 'seconds' select time unit

(-b=1)↓∊ determine if singular if so drop final s in time unit

b, concatenate number of units to time unit from previous two steps


# APL+WIN, 88 119 bytes

Original version missed out weeks and months as pointed out by Phil H;(

Prompts screen input of number of seconds

a←⌽<\⌽1≤b←⎕÷×\1 60 60 24 7,(31÷7),365÷31⋄b,(-(b←⌊a/b)=1)↓∊a/'seconds' 'minutes' 'hours' 'days' 'weeks' 'months' 'years'


Explanation

b←⎕÷×\1 60 60 24 7,(31÷7),365÷31 prompts for input and converts to years, days, hours, minutes, seconds

a←⌽<\⌽1≤b identify largest unit of time and assign it to a

a/'years' 'days' 'hours' 'minutes' 'seconds' select time unit

(-(b←⌊a/b)=1)↓∊ determine if singular if so drop final s in time unit

b, concatenate number of units to time unit from previous steps

2 added 399 characters in body

# APL+WIN, 88 bytes

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365 24 60 60⊤⎕⋄b,(-b=1)↓∊a/'years' 'days' 'hours' 'minutes' 'seconds'


Explanation

1E10 365 24 60 60⊤⎕ prompts for input and converts to years, days, hours, minutes, seconds

b←(a←<\0<b) identify largest unit of time and assign it to b

a/'years' 'days' 'hours' 'minutes' 'seconds' select time unit

(-b=1)↓∊ determine if singular if so drop final s in time unit

b, concatenate number of units to time unit from previous two steps


# APL+WIN, 88 bytes

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365 24 60 60⊤⎕⋄b,(-b=1)↓∊a/'years' 'days' 'hours' 'minutes' 'seconds'


# APL+WIN, 88 bytes

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365 24 60 60⊤⎕⋄b,(-b=1)↓∊a/'years' 'days' 'hours' 'minutes' 'seconds'


Explanation

1E10 365 24 60 60⊤⎕ prompts for input and converts to years, days, hours, minutes, seconds

b←(a←<\0<b) identify largest unit of time and assign it to b

a/'years' 'days' 'hours' 'minutes' 'seconds' select time unit

(-b=1)↓∊ determine if singular if so drop final s in time unit

b, concatenate number of units to time unit from previous two steps

1

# APL+WIN, 88 bytes

Prompts screen input of number of seconds

b←(a←<\0<b)/b←1E10 365 24 60 60⊤⎕⋄b,(-b=1)↓∊a/'years' 'days' 'hours' 'minutes' 'seconds'