title: Groovy: Get duration in years
body: <p>On running the following code in groovy -</p>
  
  <pre><code>import groovy.time.*
  import org.codehaus.groovy.runtime.TimeCategory
  def today = new Date()
  use(TimeCategory)
  {
    def modifiedToday = today.plus(10.minutes)
    modifiedToday = modifiedToday.plus(10.months)
    modifiedToday = modifiedToday.plus(10.years)
    def duration = modifiedToday - today
    println duration.years
    println duration.months
    println duration.days
    println duration.minutes
  }
  </code></pre>
  
  <p>I am getting the following output -</p>
  
  <pre><code>0
  0
  3956
  10
  </code></pre>
  
  <p>Please suggest, why am I getting years and months as 0 and all the value in days. How do I get the value in years and months?</p>