DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceremovePAGE ELEMENTSWrite and magicaddText elementsaddData elementsremovest.dataframest.data_editorst.column_configremoveColumnText columnNumber columnCheckbox columnSelectbox columnDatetime columnDate columnTime columnList columnLink columnImage columnArea chart columnLine chart columnBar chart columnProgress columnst.tablest.metricst.jsonChart elementsaddInput widgetsaddMedia elementsaddLayouts and containersaddChat elementsaddStatus elementsaddThird-party componentsopen_in_newAPPLICATION LOGICNavigation and pagesaddExecution flowaddCaching and stateaddConnections and secretsaddCustom componentsaddUtilitiesaddConfigurationaddTOOLSApp testingaddCommand lineaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/API reference/Data elements/st.column_config/Date columnst.column_config.DateColumnStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeConfigure a date column in st.dataframe or st.data_editor.
This is the default column type for date values. This command needs to be used in
the column_config parameter of st.dataframe or st.data_editor. When used
with st.data_editor, editing will be enabled with a date picker widget.
Function signature[source] st.column_config.DateColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, format=None, min_value=None, max_value=None, step=None) Parameters

label
(str or None)

 
The label shown at the top of the column. If None (default),
the column name is used.


width
("small", "medium", "large", or None)

 
The display width of the column. Can be one of "small", "medium", or "large".
If None (default), the column will be sized to fit the cell contents.


help
(str or None)

 
An optional tooltip that gets displayed when hovering over the column label.


disabled
(bool or None)

 
Whether editing should be disabled for this column. Defaults to False.


required
(bool or None)

 
Whether edited cells in the column need to have a value. If True, an edited cell
can only be submitted if it has a value other than None. Defaults to False.


default
(datetime.date or None)

 
Specifies the default value in this column when a new row is added by the user.


format
(str or None)

 
A momentJS format string controlling how times are displayed. See
momentJS docs for available
formats. If None (default), uses YYYY-MM-DD.


min_value
(datetime.date or None)

 
The minimum date that can be entered.
If None (default), there will be no minimum.


max_value
(datetime.date or None)

 
The maximum date that can be entered.
If None (default), there will be no maximum.


step
(int or None)

 
The stepping interval in days. If None (default), the step will be 1 day.
Examples

from datetime import date
import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
    {
        "birthday": [
            date(1980, 1, 1),
            date(1990, 5, 3),
            date(1974, 5, 19),
            date(2001, 8, 17),
        ]
    }
)

st.data_editor(
    data_df,
    column_config={
        "birthday": st.column_config.DateColumn(
            "Birthday",
            min_value=date(1900, 1, 1),
            max_value=date(2005, 1, 1),
            format="DD.MM.YYYY",
            step=1,
        ),
    },
    hide_index=True,
)

Built with Streamlit 🎈Fullscreen open_in_new

Previous: Datetime columnNext: Time columnforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy