Format Changing Problem of Number Input

The program offers the number format as Default in a,b format but I want to show as a:b format
How can I change this? I tried below but it didn’t work:

st.number_input(“time”)).replace(" , " , " : ")

Hi @murat_tasci -

It doesn’t work, because the value returned by number_input is an int or float. However, the function does have a parameter format that allows you to change the display within Streamlit. See the docs for more information:


Hi @murat_tasci , wouldn’t it be better to use the time widget for time, instead of the number input? That way, you would get your ‘:’ character too.

The reference is : st.time_input - Streamlit Docs


Hi @Shawn_Pereira
I want to use time widget but as far as I know it is not possible to see every single time value on time widget menu like 00:01, 00:02, 00:03…00:04 … 12:00 etc. If it is possible, could you share the code for this?
Note:The values has intervals as 15 mins last have I seen streamlit widget menu. (00:15, 00:30, 00:45, 1:00 etc.)

Hi @murat_tasci , in one of my projects, I implemented a selectbox for time which had a tuple containing sorted elements 5 minutes apart. (i.e. 00:00, 00:05, 00:10…00:15…). You could try any method that suits your purpose.


Hi @randyzwitch, I have a question which is over the picture too.

I tried below but I can’t be able to access default displaying settings in - + section.
number = str(st.number_input(“Saat”,format="%f")).replace(".",":")

Multi-select solution:

start = "00:00"
    end = "23:59"
    times = []
    start = now = datetime.datetime.strptime(start, "%H:%M")
    end = datetime.datetime.strptime(end, "%H:%M")
    while now != end:
        now += datetime.timedelta(minutes=1)
    st.multiselect('Departure hour:',times)