Year day conversion code from book.

In preparation for exercise.