[plt-scheme] scalinger->date

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Wed Aug 23 21:58:40 EDT 2006

I knew this one would come back to haunt. (-:

The reason d->j/s exists it is because it provides an easy way to
perform arithmetic and logic on dates: for instance, checking whether
one date is before another, and computing the number of days between
two dates.

I'm sure an inverse function exists, but because the arithmetic *I*
cared about didn't produce meaningful day numbers (ie, the difference
between yesterday and today is 1, but the corresponding date in the
calendar is not relevant to this use), it didn't seem necessary.

Oh, and the other reason it's there is I recall that was the one date
format Common Lisp didn't have, and we wanted to be cooler.

So, I'm afraid, that's why it doesn't exist.  If the inverse
conversion really is useful to you, I'm sure you can find the
computation quite easily on the Web (back when d->j/s was first
written this sort of thing actually needed looking up in a book) and
can contribute the code....  Actually, here you go:

http://en.wikipedia.org/wiki/Julian_day

[By the way, that Wikipedia entry has a hard-coded JD in it.  It'd be
so cool if a Web programming language let you write reactive
computations in the middle of a Web page....]

One warning: a day starts at noon, not at midnight, so a "day" in this
calendar corresponds to two different Gregorian days.

Shriram


Posted on the users mailing list.