A few years ago I was working with a shell script that was a batch front-end for a complex system handling monitoring data. This script was intended to be run from cron every month to create a monthly summary report. Typically, it executed early morning the 1st of every month, producing a report for the last month.
The problem was to compute date-time of the first and last seconds of the previous month. I needed a simple way to express dates such as "give me the end time of the last day of the previous month ". As a well-known fact months can be 28, 30, 31 (and 29) days long. I couldn't find a convenient command that gave me the answers. Unix date was of no help.
That problem inspired me to create a small Java class that solved the immediate problem. Later I refined it and made it more versatile.
When I was about to release the first public version, I started to scrutinize my design and realized it could be better. I therefor re-wrote all of it and improved the simplicity of the operators and the separation of concerns in the design.
Vallentuna/Stockholm/Sweden, 17 February 2008
Jens Riboe