Download this notebook from GitHub (right-click to download).

import datetime as dt
import panel as pn


The DatetimeInput widget allows entering a datetime value as text and parsing it using a pre-defined formatter.

For more information about listening to widget events and laying out widgets refer to the widgets user guide. Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the param user guide. To express interactivity entirely using Javascript without the need for a Python server take a look at the links user guide.


For layout and styling related parameters see the customization user guide.


  • start (datetime): Lower bound

  • end (datetime): Upper bound

  • value (datetime): Parsed datetime value


  • disabled (boolean): Whether the widget is editable

  • format (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))


DatetimeInput.value returns a datetime object and can be accessed and set like other widgets:

datetime.datetime(2019, 2, 8, 0, 0)


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)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).