title: How to get date 7 days ago to today in Kotlin?
body: <p>I want to get date from 7 days ago to today in Kotlin. Any suggestions? This is what I have so far</p>
  
  <pre><code>val date = Calendar.getInstance()
  
  val yesterday = Calendar.getInstance()
  
  yesterday.add(Calendar.DATE,-1)
  
  var todayOrYesterday:String?
  
  var todayDate = date.time
  
  while (todayDate &gt; yesterday.time){
  
      val formatter = SimpleDateFormat("EEEE, d MMMM yyyy")
  
      val format = formatter.format(todayDate)
  
      println(format)
  
      todayOrYesterday = if (DateUtils.isToday(date.timeInMillis)) {
              "Today"
      }else "Yesterday"
  
      date.add(Calendar.DATE,-7)
  }
  </code></pre>