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

import datetime as dt
import panel as pn


The DatetimeRangeInput widget allows selecting a datetime range using two DatetimeInput widgets, which return a tuple range.

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.


  • format (str): Datetime formatting string that determines how the value is formatted and parsed (default='%Y-%m-%d %H:%M:%S')

  • start (datetime): The range’s lower bound

  • end (datetime): The range’s upper bound

  • value (tuple): Tuple of upper and lower bounds of the selected range expressed as datetime types


  • disabled (boolean): Whether the widget is editable

  • 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)”:

datetime_range_input = pn.widgets.DatetimeRangeInput(
    name='Datetime Range Input',
    start=dt.datetime(2017, 1, 1), end=dt.datetime(2019, 1, 1),
    value=(dt.datetime(2017, 1, 1), dt.datetime(2018, 1, 10)),


DatetimeRangeInput.value returns a tuple of datetime values that can be read out and set like other widgets:

(datetime.datetime(2017, 1, 1, 0, 0), datetime.datetime(2018, 1, 10, 0, 0))


The DatetimeRangeInput widget is a composite widget, which requires Python for communication. Therefore the controls only work when connected in a live Python server/kernel:

pn.Row(datetime_range_input.controls(jslink=False), datetime_range_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).