Skip to main content
added 145 characters in body
Source Link
user100690
user100690

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • On the topic of the year zero: Your answer must follow the ISO specifications, meaning there is a year zero.
  • You may assume that the input is always an integer within bounds of your language number system.
  • If your language's date functions take leap seconds into account, then follow your language, otherwise do not take leap seconds into account.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • On the topic of the year zero: Your answer must follow the ISO specifications, meaning there is a year zero.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • On the topic of the year zero: Your answer must follow the ISO specifications, meaning there is a year zero.
  • You may assume that the input is always an integer within bounds of your language number system.
  • If your language's date functions take leap seconds into account, then follow your language, otherwise do not take leap seconds into account.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 
Tweeted twitter.com/StackCodeGolf/status/1361691837979910148
Became Hot Network Question
Post Reopened by Wheat Wizard
added 118 characters in body
Source Link
user100690
user100690

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • On the topic of the year zero: Your answer must follow the ISO specifications, meaning there is a year zero.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • On the topic of the year zero: Your answer must follow the ISO specifications, meaning there is a year zero.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 
Post Closed as "Needs details or clarity" by Wheat Wizard
added 24 characters in body
Source Link
user100690
user100690

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 

You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.

Rules

  • You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
  • Standard loopholes forbidden.
  • Shortest answer in bytes wins.
  • Built-in date functions are allowed.
  • You must also support negative numbers.
  • You may assume that the input is always an integer within bounds of your language number system.

Examples (in this case, measured at the time of writing, which is February 15, 2021)

100000000000 -> 5190 1000 -> 2021 54398643 -> 2022 54398643234 -> 3744 -100000000000 -> -1148 
deleted 38 characters in body; edited title
Source Link
Loading
added 26 characters in body
Source Link
user100690
user100690
Loading
updated outputs
Source Link
user100690
user100690
Loading
Source Link
user100690
user100690
Loading