The Calendar class has a getActualMaximum() method that we can use to find the last day of a month. Calendar calendar = GregorianCalendar.instance calendar.set(2010,3,1) // 1st April 2010 def lastDay = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH) assert lastDay == 30