Tuesday, April 24, 2012

First and last day of the month using Joda text

I had to create a SQL dump right after a new quarter starts. For example, if today is April 1st, then I had to create a dump file with the dates from 2012-01-01 to 2012-03-31.  The only problem was generating the first and end of the month using Java.  The best calendar/date API is by far Joda Date.  Here is the script on how I generated the two dates: