Datetimepicker

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


import datetime

import panel as pn

pn.extension()

The DatetimePicker widget allows selecting selecting a datetime value using a text box and the browser’s datetime-picking utility.

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.

Parameters:

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

Core

  • value (datetime): The selected value as a datetime type

  • start (date): Start date of the widget

  • end (date): End date of the widget

  • disabled_dates (list): Dates to make unavailable for selection; others will be available

  • enabled_dates (list): Dates to make available for selection; others will be unavailable

  • enable_time: (boolean): Enable change of the time in the widget, default is True

  • enable_seconds: (boolean): Enable change of the seconds in the widget, default is True

  • military_time: (boolean): Enable 24 hours time in the widget, default is True

Display

  • disabled (boolean): Whether the widget is editable

  • visible (boolean): Whether the widget is visible

  • name (str): The title of the widget


DatetimePicker uses a browser-dependent calendar widget to select the datetime:

datetime_picker = pn.widgets.DatetimePicker(name='Datetime Picker', value=datetime.datetime(2021, 3, 2, 12, 10))

datetime_picker

DatetimePicker.value returns a datetime type that can be read out or set like other widgets:

datetime_picker.value
datetime.datetime(2021, 3, 2, 12, 10)

Controls

The DatetimePicker 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(datetime_picker.controls(jslink=True), datetime_picker)
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).