title: Compare Calendar and LocalDate in Kotlin
body: <p>I have a <code>Calender</code> object that is chosen by user. I need to compare this object (or convert) with <code>LocalDate</code>. Is there any way to do that? I am getting calendar object by that :</p>
  <pre><code>        val calendar = Calendar.getInstance()
          val calendar2 = Calendar.getInstance()
          val pickDate = DatePickerDialog.OnDateSetListener { view, year, month, dayOfMonth -&gt;
              calendar.set(Calendar.YEAR,year)
              calendar.set(Calendar.MONTH,month)
              calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth)
  
              update(calendar)
  
          }
          val pickTime = TimePickerDialog.OnTimeSetListener { view, hour, minute -&gt;
              calendar2.set(Calendar.HOUR_OF_DAY,hour)
              calendar2.set(Calendar.MINUTE,minute)
              update2(calendar2)
          }
  
          datePicker.setOnClickListener {
              DatePickerDialog(this.requireContext(),pickDate,calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)).show()
  
  
  
          }
          timePicker.setOnClickListener {
              TimePickerDialog(this.requireContext(),pickTime,calendar2.get(Calendar.HOUR_OF_DAY),calendar2.get(Calendar.MINUTE),true).show()
          }
  
      }
  
      @SuppressLint(&quot;SetTextI18n&quot;)
      fun update(calendar : Calendar)  {
          val format = SimpleDateFormat(&quot;dd-MM-yyyy&quot;,Locale.US).format(calendar.time)
          showDate.text = format
  
  
  
  
      }
      fun update2(calendar : Calendar)  {
          val format2 = SimpleDateFormat(&quot;HH:mm&quot;,Locale.US).format(calendar.time)
          showDate2.text = format2
  
      }
  }
  </code></pre>