Can't edit format for st.date_input

I want to try to edit the format of st.date_input.

but I get this error message: “TypeError: TimeWidgetsMixin.date_input() got an unexpected keyword argument ‘format’”

from datetime import date, datetime
import streamlit as st
add_event = 0


if st.button("Add Event"):
    add_event = 1

if add_event == 1:
    st.text_input("What's the name of your event?")
    new_event = st.date_input("When is your event?", format="DD/MM/YYYY")

please help!

The format kwarg was recently introduced in version 1.25.0, my guess is that you are working with a previous version of streamlit. You can upgrade via pip:

pip install -U streamlit
1 Like

Great! Thank you! Now it works, however, I’d like it to be the last to digits of the year (this year: 23) and streamlit doesn’t support that format, do you know any other way to remove the first two digits of the year? Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.