A DateTimePicker in mobile UI design combines date and time selection in one interface.
If you want a date picker only see DatePicker or if you want time picker only see TimePicker
Examples
Example - Default
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Date Time Picker", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
}
btn_onTouch()
{
ui.showDateTimePicker( this.onDateTime )
}
onDateTime( val )
{
ui.showPopup( val )
}
}
class Main extends App
onStart()
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Date Time Picker", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
btn_onTouch()
ui.showDateTimePicker( this.onDateTime )
onDateTime( val )
ui.showPopup( val )
Example - With initial values, format and custom theme
class Main extends App
{
onStart()
{
ui.setThemeColor( "#673ab7" );
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Date Time Picker", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
}
btn_onTouch()
{
ui.showDateTimePicker("2023-10-10", "17:00:00", "LLL", this.onDateTime )
}
onDateTime( val )
{
ui.showPopup( val )
}
}
class Main extends App
onStart()
ui.setThemeColor( "#673ab7" )
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Date Time Picker", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
btn_onTouch()
ui.showDateTimePicker("2023-10-10", "17:00:00", "LLL", this.onDateTime )
onDateTime( val )
ui.showPopup( val )
Example - Dark mode
class Main extends App
{
onStart()
{
ui.setTheme( "dark" );
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton( this.main, "Show Date Time Picker", "Primary" )
this.btn.setOnTouch( this.btn_onTouch )
}
btn_onTouch()
{
ui.showDateTimePicker( this.onDateTime )
}
onDateTime( val )
{
ui.showPopup( val )
}
}
class Main extends App
onStart()
ui.setTheme( "dark" )
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton( this.main, "Show Date Time Picker", "Primary" )
this.btn.setOnTouch( this.btn_onTouch )
btn_onTouch()
ui.showDateTimePicker( this.onDateTime )
onDateTime( val )
ui.showPopup( val )