Calculating weekdays and dates with Go

Stage Fright

The preparations are complete, and your training program can begin! Advanced students are also welcome to extend the program by training for several changing years with different Doomsdays. If you want to simulate the time pressure that a magician experiences in front of an impatient audience, you can add a progress bar [3] to the game as an additional stress factor; this leaves the candidate only a short time to choose the day of the week. If the time expires, the score drops to zero points, which you could even accompany by a game show klaxon sound by playing an appropriate sound file. Enjoy!


  1. "Perl Script Reveals Math Trick" by Mike Schilli, Linux Magazine, issue 87, February 2008, p. 80
  2. Doomsday rule:
  3. "Develop a DIY Progress Bar" by Mike Schilli, Linux Magazine, issue 220, March 2019, pp. 46-49
  4. Listings for this article:
  5. Leap second:

The Author

Mike Schilli works as a software engineer in the San Francisco Bay area, California. Each month in his column, which has been running since 1997, he researches practical applications of various programming languages. If you email him at he will gladly answer any questions.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Command Line: cal and date

    The legacy cal and date tools help users keep track of the time and date. You can even change the system time with a single shell command.

  • SuperKaramba Workshop

    If you can’t find the SuperKaramba theme you’re looking for, you can always build your own.

  • Programming Snapshot – Mileage AI

    On the basis of training data in the form of daily car mileage, Mike Schilli's AI program tries to identify patterns in driving behavior and make forecasts.

  • Perl: Math Tricks

    A trick that anybody can learn lets you determine the day of the week from the date. We’ll apply some Perl technology to discover whether the method is reliable.

  • Command Line: Calendar Tools

    We take a spin through several personal calendar apps that you can manage from the command line.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95