Easy to use android date and time picker.
- Very easy to use
- Use both date and time or choose just one
- Written in kotlin
- Sample app is ready to build
Click HERE.
val sdf = SimpleDateFormat("dd.MM.yyyy - HH:mm", Locale.getDefault())
val dateText : String? = null
val callback: (date: Date) -> Unit = { newDate ->
dateText = sdf.format(newDate)
}
DateTimePickerDialog.show(
supportFragmentManager,
"fragment_datepicker", //tag for fragment manager
callback, //calback with selected date
Date(), //current date
DateTimePickerDialog.TIME_DATE //choose one - DATE_TIME, TIME_ONLY, DATE_ONLY, TIME_DATE
)