5 Changed 90 into 119 for clarity, as 90 is not strictly greater than 60*1.5
source | link

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
119        : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Consider the given length of time to be an age. For example, after 90119 seconds, 1 minute has passed, not 2.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Consider the given length of time to be an age. For example, after 90 seconds, 1 minute has passed, not 2.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
119        : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Consider the given length of time to be an age. For example, after 119 seconds, 1 minute has passed, not 2.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!
4 more clarification
source | link

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has pastpassed, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Consider the given length of time to be an age. For example, after 90 seconds, 1 minute has passed, not 2.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has past, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Consider the given length of time to be an age. For example, after 90 seconds, 1 minute has passed, not 2.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!
3 More examples
source | link

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has past, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has past, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!

Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.

Your program must output the least precise amount of time which has past, among the following metrics and their lengths in seconds:

second = 1
minute = 60
hour   = 60 * 60
day    = 60 * 60 * 24
week   = 60 * 60 * 24 * 7
month  = 60 * 60 * 24 * 31
year   = 60 * 60 * 24 * 365

Examples

input      : output
1          : 1 second
59         : 59 seconds
60         : 1 minute
120        : 2 minutes
43200      : 12 hours
86401      : 1 day
1815603    : 3 weeks
1426636800 : 45 years

As you can see above, after the time of say, 1 day (60 * 60 * 24 = 86400 seconds), we no longer output minute(s) or hour(s), but only days until we surpass the time of one week, and so on.

Rules

  • No specification for 0 or negative inputs.
  • Follow proper pluralization. Every measure greater than 1 must include an s following the word.
  • You may not use a pre-existing library which serves the function of the entire program.
  • This is a code golf, shortest program wins the internet points.
  • Have fun!
    Tweeted twitter.com/StackCodeGolf/status/975420813884252165
2 Clarification of output
source | link
1
source | link