For some of my notes from long ago I find it helpful to quickly check what weekday a certain date was. I don’t want to go to a website for it that shows me, of which there are several.
I do like making tiny personal tools though.

So I wrote a tiny php script with a webform for my local web server, to tell me the weekday for a given date.

Such small things give me a suprisingly large amount of pleasure to make and see it work. Next step is to do this over the command line or through Alfred, rather than a web interface. Update: found an Alfred workflow that I adapted, which either shows the day or puts it on the clipboard for pasting.

The code is easy as PHP has a function for it.

if ($_POST) {

$dag = $_POST['dag'];
$maand = $_POST['maand'];
$jr = $_POST['jaar'];

$jd=gregoriantojd($maand,$dag,$jr); /*NB this function uses the awkward US date format m/d/y */
echo $dag."-".$maand."-".$jr." was een ".jddayofweek($jd,1);
}

2 reactions on “What Weekday Was ….

  1. On most unix-like command lines, you’ll have `cal` available, with plenty of options for showing specific things. That might help?

  2. Or, without the need for a conversion to Julian:

    “`
    echo $dag.”-“.$maand.”-“.$jr.” was een “. date(‘l’, mktime(12, 0, 0, $maand, $dag, $jr));
    “`

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.