title: Kotlin: Getting the difference betweeen two dates (now and previous date)
body: <p>Sorry if similar questions have been asked too many times, but it seems that there's one or more issues with every answer I find.</p>
  
  <p>I have a date in the form of a String: Ex.: "04112005"</p>
  
  <p>This is a date. 4th of November, 2005.</p>
  
  <p>I want to get the difference, in years and days, between the current date and this date.</p>
  
  <p>The code I have so far gets the year and just substracts them:</p>
  
  <pre><code>fun getAlderFraFodselsdato(bDate: String): String {
      val bYr: Int = getBirthYearFromBirthDate(bDate)
      var cYr: Int = Integer.parseInt(SimpleDateFormat("yyyy").format(Date()))
  
      return (cYr-bYr).toString()
  }
  </code></pre>
  
  <p>However, naturally, this is quite innacurate, since the month and days aren't included.</p>
  
  <p>I've tried several approaches to create Date, LocalDate, SimpleDate etc. objects and using these to calcualate the difference. But for some reason I haven't gotten any of them to work.</p>
  
  <p>I need to create a Date (or similar) object of the current year, month and day. Then I need to create the same object from a string containing say, month and year (""04112005""). Then I need to get the difference between these, in years, months and days.</p>
  
  <p>All hints are appreciated.</p>