Return to Snippet

Revision: 11397
at February 4, 2009 04:54 by narkisr


Initial Code
def cal = Calendar.instance
cal.set(2009,Calendar.FEBRUARY,2)
def ghday = cal.time
cal.set(2009,Calendar.MARCH,21)
def spring = cal.time
def days = (ghday..spring).size()
println "Between Feb 2 and Mar 21, there are $days days" 
// will print Between Feb 2 and Mar 21, there are 48 days

Initial URL

                                

Initial Description
Groovy ranges works on dates also!
(http://kousenit.wordpress.com/2009/02/02/groovy-groundhogs/)

Initial Title
Groovy date ranges

Initial Tags
date, groovy

Initial Language
Groovy