Is it Christmas?

Bash, 39

For those who just can't wait:

sudo date 12250000
echo It\'s Christmas

This follows all of the rules, especially the first one.


Unix, 39 bytes

echo{,} "It\'s christmas"|at -t12252359

With help from Dennis, thanks for that.


PowerShell, 45 46 chars

for(;(date).date-ne'12/25'){}"It's Christmas"

It's certainly not very power-efficient, so a laptop battery might die before Christmas (reason to wish for a new one, maybe). But not sleeping is definitely shorter.

This is also locale-agnostic. And thanks to Jaykul for a nice trick in reducing this further.

Abusing the rules a bit, 45 chars

for(){"It's Christmas"*((date)-like'12/25*')}

This will print empty lines until it's Christmas, upon which it will print “It's Christmas”.

It ...

  • ... can be started at any time.
  • ... prints “It's Christmas” on Christmas. Several times. The whole day long. (The rules didn't say anything about how often it may be printed.)
  • ... does not print “It's Christmas” on not-Christmas (although it prints an empty line in that case; can be rectified by sacrificing another character, but then this gains nothing over the more sane solution above).
  • ... does not ever stop (not even after it has printed “It's Christmas” but definitely not before).

Tags:

Date

Code Golf