Skip to content

Qase/AndroidDateTimePicker

Repository files navigation

Release Build Status codebeat badge API License: MIT Maintainer: havlisimo Qase: AndroidDateTimePicker

AndroidDateTimePicker

Easy to use android date and time picker.

Features

  • Very easy to use
  • Use both date and time or choose just one
  • Written in kotlin
  • Sample app is ready to build

Installation

Click HERE.

Code example

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
)

License

MIT