September 13, 2020

Happy Programmers Day!

A day worthy of celebration.

September 13 is the 256th Day of the Year (non-leap years). The date for this epic celebration is obvious for those it concerns. The history and origin of this important day of the year seems obfuscated, cluttered and forgotten; no matter what - the importance remain the same.

The excellent resource of anything date-time related explain in detail what the fuzz is all about.

Why should you bother?

Firefigthers rescue kittens from trees, doctors save lifes, programmers keep the world alive.

Clojure our way to Programmers Day

Make sure you have clojure's date-time in your class-path:

:dependencies [[ "0.3.2"]]

Define this handy little function. It'll return the number of days from a given date as argument - or if no argument provided - from today.

(ns your.favourite.namespace
  (:require [java-time :as jt]))

(defn- count-down
   (let [now (jt/local-date)]
     (count-down now)))

   (let [now              (jt/local-date date)
         programmers-day  (jt/local-date "2021-09-13")]

     (jt/time-between now programmers-day :days))))

And then you want to test it. Crank up your repl...

(in-ns 'your.favourite.namespace)

    => 232

  (count-down "2021-05-17")
    => 119

Tags: blog