33
\$\begingroup\$

On most challenges when it is currently not the corresponding year of the challenge, It says this in the front.

It's [current year] already, folks, go home.

You have to output this text with the current year substituted.


I/O

Input: None.

Output: It's [year] already, folks, go home. with [year] changed to the current year.

\$\endgroup\$
11
  • 17
    \$\begingroup\$ First test run, got the time instead of the date: It's 8:58 already, folks, go home. \$\endgroup\$
    – steenbergh
    Apr 1, 2017 at 9:59
  • \$\begingroup\$ Can I take input and then ignore it (i.e do something along the lines of String goHome(Object foo){return "It's "+currentYear()+" already, folks, go home.";} (but much shorter, of course))? \$\endgroup\$
    – dorukayhan
    Apr 1, 2017 at 17:02
  • \$\begingroup\$ It's a shame I shouldn't compile the challenge to literally: ///, 46 bytes It's the current year already, folks, go home. \$\endgroup\$
    – sporklpony
    Apr 1, 2017 at 17:33
  • 3
    \$\begingroup\$ @steenbergh If only school was that way in the morning. xD :P \$\endgroup\$
    – hyper-neutrino
    Apr 1, 2017 at 21:33
  • \$\begingroup\$ I feel this challenge would be more appropriate if it were "if it's not the current year, output this, else output nothing", but still good challenge +1 \$\endgroup\$
    – Tas
    Apr 3, 2017 at 2:50

63 Answers 63

1
\$\begingroup\$

T-SQL, 66 bytes

print concat('It''s ',year(getdate()),' already, folks, go home.')
\$\endgroup\$
1
\$\begingroup\$

JavaScript ES6, 63 62 bytes

_=>`It's ${new Date().getFullYear()} already, folks, go home`
\$\endgroup\$
4
  • 3
    \$\begingroup\$ Syntax error, you have an extra closing ). \$\endgroup\$
    – manatwork
    Apr 1, 2017 at 13:04
  • \$\begingroup\$ Oops, fixed now. \$\endgroup\$
    – Luke
    Apr 2, 2017 at 11:33
  • \$\begingroup\$ Uhm… I wrote “extra closing )”, not “missing opening (”. ;) \$\endgroup\$
    – manatwork
    Apr 3, 2017 at 10:54
  • \$\begingroup\$ You're right... \$\endgroup\$
    – Luke
    Apr 3, 2017 at 15:50
1
\$\begingroup\$

Javascript, 67 bytes

alert("It's "+new Date().getFullYear()+" already, folks, go home.")
\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 65 bytes

Edit: This one should handle years of any size, even though SB (as far as I'm aware) doesn't support any year that isn't 4 characters.

?"It's "+LEFT$(DATE$,INSTR(DATE$,"/"))+" already, folks, go home.
\$\endgroup\$
1
  • \$\begingroup\$ Does this works in year 20017? \$\endgroup\$ Apr 4, 2017 at 10:20
1
\$\begingroup\$

Excel, 48 bytes

="It's "&YEAR(NOW())&" already, folks, go home."
\$\endgroup\$
1
\$\begingroup\$

Noodel, 34 bytes

Ƈƈy”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ

Try it:)


How it works

Ƈƈy”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ
Ƈƈy                                # Gets the current year.
Ƈ                                  # Gets the current time as an integer.
 ƈy                                # Takes the integer and gets the current year from it.

   ”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ # Creates the string.
   ”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ   # Pushes on the string "It's¤ð¤already,¤folks,¤go¤home." as an array splitting on the "ð" character where "¤" is a space.
                                   # (space) NOOP that separates commands.
                                 İ # Concatenate the array using the current year.
                                   # Implicitly print to the screen.

<div id="noodel" code="Ƈƈy”VẠṇ`DðC1}816ṚĊC:@-~ḂC'^D^#8Ụ İ" input="" cols="40" rows="2"></div>

<script src="https://tkellehe.github.io/noodel/noodel-latest.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>

\$\endgroup\$
1
\$\begingroup\$

QBIC, 48 bytes

?@It's `+right$(_D,4)+@ already, folks, go home.

I really should start working on substring...

Explanation:

?       PRINT
@ ... ` String literal: 
        - creates a string with all the text from @ to `, 
        - stores it as the first available string var (A$)
        - and injects A$ at the current point in the QBasic translated code.
+       String concatenation
right$  QBasic function to take characters from the right.
_D      QBIC's call to get the system date as dd-mm-yyyy (_d gets the time)
+@ ...  Second string lit (B$). Doesn't need the closing ` because of EOF.

Update: Substring saves me 4 bytes:

?@It's `+_s_D,-4|+@ already, folks, go home.
\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 51 bytes

?"It's ";LEFT$(DATE$,4);" already, folks, go home.

I don't think it's reasonable to ever expect support for 5 digit years, but if SB gets updated in 10 millennia, then this should work for 1 extra byte:

DTREAD OUT Y,,?"It's ";Y;" already, folks, go home.
\$\endgroup\$
1
\$\begingroup\$

Aceto, 39 38 + 1 for (-l flag) 40 39 bytes

τ"It's "pp" already, folks, go home."p

Try it online!

Saved one byte thanks to DLosc

τ"It's "pp" already, folks, go home."p
τ                 push local datetime on stack
"..."             push the first part of the string
     pp           print both
       "..."      second part of string
            p     print it
\$\endgroup\$
1
  • \$\begingroup\$ @DLosc Nice! I'll update \$\endgroup\$ Mar 4, 2018 at 7:23
1
\$\begingroup\$

APL (Dyalog), 44 40 bytes

4 saved thanks to Uriel by rearranging the structure

¯5⌽'already, folks, go home.It''s',1⊃⎕ts

Try it online!

Explanation

'alrea ... It''s', ⍝ "alrea .. It's" concatenated with
1⊃⎕ts              ⍝ the first element in the ⎕ts (contains the year)
¯5⌽                ⍝ rotated 5 times to the right
\$\endgroup\$
2
  • \$\begingroup\$ 40 - ¯5⌽'already, folks, go home.It''s',1⊃⎕ts \$\endgroup\$
    – Uriel
    Mar 4, 2018 at 23:58
  • \$\begingroup\$ @Uriel Thanks for me getting the crossed out 44 :D \$\endgroup\$
    – user41805
    Mar 7, 2018 at 18:02
1
\$\begingroup\$

SenseTalk, 47 bytes

put "It's"&&the year&&"already, folks, go home"
\$\endgroup\$
0
\$\begingroup\$

Lua, 59 bytes

Gets the system date

print("It's "..os.date('%Y').." already, folks, go home.")
\$\endgroup\$
0
\$\begingroup\$

REXX, 53 bytes

say "It's" left(date(s),4) "already, folks, go home."
\$\endgroup\$
2
  • \$\begingroup\$ Does this work in year 20017? \$\endgroup\$ Apr 4, 2017 at 10:23
  • \$\begingroup\$ No, it assumes a four-character year. \$\endgroup\$
    – idrougge
    Apr 4, 2017 at 11:19
0
\$\begingroup\$

Gawk, 64 60 bytes

GNU Awk has a couple of built-in function to get current time and date.

BEGIN{print"It's "strftime("%Y")" already, folks, go home."}

Edit

The script can run from a file (-f), which saves 4 bytes (thanks manatwork).

\$\endgroup\$
3
  • \$\begingroup\$ Actually that is just 60 bytes. The enclosing single quotes and the escape code for single quote are needed only because the shell. You can put the code in a file max.awk and run it as gawk -f max.awk, so becomes clear that only the 60 bytes in the file needs to be counted. (The -f command line option is for free, other command line options would be counted.) \$\endgroup\$
    – manatwork
    Apr 3, 2017 at 11:01
  • \$\begingroup\$ @manatwork I didn't know that -f is free. But it's shorter the way you say it, no matter if it was free or not. I am really confused when counting command line options towards the byte count. Is there a rule or a post that talks about which options count and which don't? I couldn't find it on my own. \$\endgroup\$ Apr 3, 2017 at 12:03
  • \$\begingroup\$ Not a great reading, but we used to point freshmen to On “interactive” answers and other special conditions. Generally, is free whatever is strictly necessary to let the interpreter find the code. \$\endgroup\$
    – manatwork
    Apr 3, 2017 at 12:27
0
\$\begingroup\$

Fourier, 101 bytes

73a116a39a115a32a~S5do32a97a108a+6a101a-4a+3a121a44aSa102a+9~Aa-3a-1a+8a44aSa103a+8aSa104aAa-2a-8a46a

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ This doesn't have as many 4s as I expected... \$\endgroup\$
    – Neil
    Apr 4, 2017 at 0:22
0
\$\begingroup\$

AHK 43 bytes

Send,It's %A_Year% already, folks, go home.
\$\endgroup\$
0
\$\begingroup\$

T-SQL 74 bytes

print 'It''s '+CAST(year(GETDATE())as varchar)+' already, folks, go home.'

Appreciate that there is a shorter answer above but in the event that you're in the SQL-Server dark ages and don't have CONCAT available this will work :)

\$\endgroup\$
0
\$\begingroup\$

Tcl, 63

No chance of ever winning

puts "It's [clock f [clock se] -f %Y] already, folks, go home."

demo

\$\endgroup\$
0
\$\begingroup\$

Forth, 49 bytes

I tried leaving off the trailing " and it worked. Cool.

." It's " time&date . ." already, folks, go home.

Try it online

time&datensec nmin nhour nday nmonth nyear
Report the current time of day. Seconds, minutes and hours are numbered from 0. Months are numbered from 1. - Source

\$\endgroup\$
0
\$\begingroup\$

Emacs/Lisp, 70 bytes

(concat "It's " (format-time-string "%Y") " already, folks, go home.")
\$\endgroup\$
1
  • 3
    \$\begingroup\$ You can reduce your byte count by removing unnecessary spaces. \$\endgroup\$
    – Pavel
    Apr 2, 2017 at 23:05
0
\$\begingroup\$

SQLite, 65 bytes

SELECT"It's "||strftime('%Y','now')||' already, folks, go home.';

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Processing.org 48 bytes

print("It's",year(),"already, folks, go home.");
\$\endgroup\$
0
\$\begingroup\$

Pyth, 38 bytes

%"It's %d already, folks, go home.".d3

Try it online!

\$\endgroup\$
0
\$\begingroup\$

VBA, 56 Bytes

MsgBox "It's " & Year(Now) & " already, folks, go home."
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Squash the spaces and save 4 bytes \$\endgroup\$
    – iBug
    Mar 7, 2018 at 5:12
0
\$\begingroup\$

VBA (Excel), 42 bytes

Using Immediate Window.

?"It's"year(now)"already, folks, go home."

\$\endgroup\$
0
\$\begingroup\$

Jekyll, 35 bytes

Jekyll is a static site generator and it's the backend of GH Pages. If only it counts as a language here.

It's :year already, folks, go home.
\$\endgroup\$
0
\$\begingroup\$

Attache, 47 bytes

C!DateFormat!"It's %Y already, folks, go home."

Try it online!

This is a constant function that returns the year it was defined in. Alternatively, a function that returns the year it was called in:

{DateFormat!"It's %Y already, folks, go home."}

And for an extra byte:

"It's %s already, folks, go home."%Date[].year|C

or

{"It's %s already, folks, go home."%Date[].year}

Nothing too special going on here in either case.

\$\endgroup\$
0
\$\begingroup\$

Python 2, 90 86 83 78 bytes

from datetime import*;print"It's",date.today().year,"already, folks, go home."

EDIT: Shaved off a couple of bytes.

EDIT: Shaved off more thanks to @HyperNeutrino

\$\endgroup\$
4
  • \$\begingroup\$ I can't believe ST beat Python 2... \$\endgroup\$ Mar 8, 2018 at 2:28
  • \$\begingroup\$ Not valid. You need to print the "It's ___ already, folks, go home" part. \$\endgroup\$
    – hyper-neutrino
    Mar 8, 2018 at 2:28
  • \$\begingroup\$ D'oh sorry... fixed... \$\endgroup\$ Mar 8, 2018 at 2:32
  • 2
    \$\begingroup\$ 78 bytes \$\endgroup\$
    – hyper-neutrino
    Mar 8, 2018 at 2:34
0
\$\begingroup\$

SOGL V0.12, 24 22 bytes

uS"³9n⁶=⅛8!⅔ηεēæ▼∙Ω╝‘⁽

Try it Here!

\$\endgroup\$
0
\$\begingroup\$

jq, 52 characters

(48 characters code + 4 characters command line options)

now|strftime("It's %Y already, folks, go home.")

Sample run:

bash-4.4$ jq -nr 'now|strftime("It'"'"'s %Y already, folks, go home.")'
It's 2018 already, folks, go home.

Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.