35
\$\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 [current year] already, folks, go home.

\$\endgroup\$
11
  • 19
    \$\begingroup\$ First test run, got the time instead of the date: It's 8:58 already, folks, go home. \$\endgroup\$
    – steenbergh
    Commented 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\$ Commented 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\$
    – sporkl
    Commented Apr 1, 2017 at 17:33
  • 6
    \$\begingroup\$ @steenbergh If only school was that way in the morning. xD :P \$\endgroup\$
    – hyperneutrino
    Commented 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
    Commented Apr 3, 2017 at 2:50

67 Answers 67

1
\$\begingroup\$

Java 8, 81 78 bytes

()->System.out.print("It's "+java.time.Year.now()+" already, folks, go home.")
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Don't need the semicolon at the end of a lambda, and either print or printf will be shorter than println. \$\endgroup\$
    – Pavel
    Commented Apr 2, 2017 at 23:11
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
    Commented Apr 1, 2017 at 13:04
  • \$\begingroup\$ Oops, fixed now. \$\endgroup\$
    – Luke
    Commented Apr 2, 2017 at 11:33
  • \$\begingroup\$ Uhm… I wrote “extra closing )”, not “missing opening (”. ;) \$\endgroup\$
    – manatwork
    Commented Apr 3, 2017 at 10:54
  • \$\begingroup\$ You're right... \$\endgroup\$
    – Luke
    Commented 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\$ Commented 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\$
    – qqq
    Commented 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
    Commented Mar 4, 2018 at 23:58
  • \$\begingroup\$ @Uriel Thanks for me getting the crossed out 44 :D \$\endgroup\$
    – user41805
    Commented Mar 7, 2018 at 18:02
1
\$\begingroup\$

SenseTalk, 47 bytes

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

Factor, 49 bytes

now year>> [I It's ${} already, folks, go home.I]

Attempt This Online!

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

Thunno 2, 26 bytes

‘It's % ¥Ƙ, ⁶Ẇ, go ⱮŻ.‘kO%

Attempt This Online!

Explanation

‘...‘kO%  # Full program
‘...‘     # Compressed string "It's % already, folks, go home."
     kO%  # Replace the "%" with the current year
          # Implicit output
\$\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\$ Commented Apr 4, 2017 at 10:23
  • \$\begingroup\$ No, it assumes a four-character year. \$\endgroup\$
    – idrougge
    Commented 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
    Commented 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\$ Commented 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
    Commented 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
    Commented 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
    Commented 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
    Commented Mar 7, 2018 at 5:12
0
\$\begingroup\$

Excel VBA, 44 Bytes

Not sure if this is a cheat... assuming "It's" in in cell A1 on an Excel worksheet and " already, folks, go home." is in A3:

Msgbox Range("A1") & Year(Now) & Range("A3")
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Well, this is . \$\endgroup\$
    – user202729
    Commented Mar 4, 2018 at 10:02
  • \$\begingroup\$ @user202729 I don't see any technical reason why (codegolf.stackexchange.com/tags/code-golf/info). This function takes no inputs as per OPs rules. What do you think? \$\endgroup\$
    – Absinthe
    Commented Mar 4, 2018 at 19:28
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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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