How to display start and end time in a user friendly format

I am trying to display the output of speech to text with speaker labels and start and end time.
Is there a way to show the time in hrs, min, sec?

I have done a conversion from milisec to sec by dividing by 1000 but that is not user-friendly.

And here is my code:

DEFAULT_TEXT = result['text']
    ALL_WORDS = result['utterances']
    for dic in ALL_WORDS:
        st.write("Speaker", dic['speaker']+":",
                 dic['start']/1000, dic['end']/1000, dic['text'], )
        print("Speaker", dic['speaker'])
    spacy_model = "en_core_web_sm"
#    text = st.text_area("Text to analyze", DEFAULT_TEXT)
 #   all_words = st.text_area("All of the words", ALL_WORDS)
    #doc = spacy_streamlit.process_text(spacy_model, text)
    doc = spacy_streamlit.process_text(spacy_model, DEFAULT_TEXT)
        labels=["PERSON", "DATE", "GPE"],
        title="Persons, dates and locations",
    st.text(f"Analyzed using spaCy model {spacy_model}")

Thanks in advance

import time 
localtime = time.asctime( time.localtime(time.time()) )
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
1 Like

Hi, I had to use a function like this to get it to display properbly. But thanks for your tip. Pointed me in the right direction.

def convertMillis(milisecs):
    millis = int(milisecs)
    seconds = (millis/1000) % 60
    seconds = int(seconds)
    minutes = (millis/(1000*60)) % 60
    minutes = int(minutes)
    hours = (millis/(1000*60*60)) % 24

    return("%d:%d:%d" % (hours, minutes, seconds))