A better "as of" date

I am not encountering a bug, so I’ve skipped some of the “What version are you running?” etc.

Bottom line: I wonder if anyone has suggestions or found examples of a more aesthetically pleasing “As Of: {date}” in their app.

Context: I’m using columns, headers, etc., as follows (code below) to display to the user the “As Of” date for the latest data the app is analyzing. However, in my opinion, it’s not very aesthetically appealing. If anyone has seen any good examples of displaying that information, I’d love to see it! I haven’t found any good examples of this personally.

col1, col2, col3 = st.columns(3)
with col1:
st.markdown("### As of: ")
with col2:
st.header(last_date_in_data_variable)
with col3:
st.write(’ ')

…looks like…

Hi @Chris_Cannon

You can compose it in a single widget using f-strings. Here are 2 examples.

import streamlit as st
from datetime import datetime as dt
st.set_page_config(layout="wide")
st.title("Subscriber Analytics 🔎")
st.markdown(f"### As of: {dt.now().date()} ")
st.caption(f"As of: {dt.now().date()} ")

image

Best Regards,

–Carlos

1 Like

That’s a valid point and is an improvement. Thank you (especially) for posting that st.caption, I think that was more what I was looking for.

Cheers!
-Chris

1 Like

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