DatetimeInput#
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).
import datetime as dt
import panel as pn
pn.extension()
The DatetimeInput
widget allows entering a datetime value as text and parsing it using a pre-defined formatter.
Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.
Parameters:#
For details on other options for customizing the component see the layout and styling how-to guides.
Core#
start
(datetime): Lower boundend
(datetime): Upper boundvalue
(datetime): Parsed datetime value
Display#
disabled
(boolean): Whether the widget is editableformat
(str): Datetime formatting string that determines how the value is formatted and parsed (default='%Y-%m-%d %H:%M:%S'
)name
(str): The title of the widget
The datetime parser uses the defined format
to validate the input value, if the entered text is not a valid datetime a warning will be shown in the title as “(invalid)
”:
dt_input = pn.widgets.DatetimeInput(name='Datetime Input', value=dt.datetime(2019, 2, 8))
dt_input
DatetimeInput.value
returns a datetime object and can be accessed and set like other widgets:
dt_input.value
Controls#
The DateTimeInput
widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
pn.Row(dt_input.controls(jslink=True), dt_input)
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).