package com.gmei
import java.text.SimpleDateFormat
import java.util.{Calendar, Date}
import java.text.SimpleDateFormat
import java.util.Calendar
import scala.collection.mutable.ArrayBuffer

object testt {

  def main(args: Array[String]): Unit ={
    val dateArray2 = get_date()
    println(dateArray2(0))
    for (elem <- dateArray2) {
      println(elem)
    }


  }
  def get_date(): ArrayBuffer[String] ={
    val startTime = "2017-12-01"
    val endTime = "2017-12-10"
    val dateFormat = new SimpleDateFormat("yyyy-MM-dd")
    val dateFiled = Calendar.DAY_OF_MONTH
    var beginDate = dateFormat.parse(startTime)
    val endDate = dateFormat.parse(endTime)
    val calendar = Calendar.getInstance()
    calendar.setTime(beginDate)
    val dateArray: ArrayBuffer[String] = ArrayBuffer()
    while (beginDate.compareTo(endDate) <= 0) {
      dateArray += dateFormat.format(beginDate)
      calendar.add(dateFiled, 1)
      beginDate = calendar.getTime
    }
    //println(dateArray)
    dateArray
  }



}

