icaoberg / cs-scholars2024-fair

CS Scholars 2024 Pre-college project
Apache License 2.0
0 stars 0 forks source link

Add today's date #28

Closed icaoberg closed 4 months ago

icaoberg commented 4 months ago

https://github.com/icaoberg/cs-scholars2024-fair/blob/0d757b6781ac29be209857d395b4b48737d9e56a/streamlit_app.py#L17

Modify this line to reflect today's date programmatically.

You can

Method Code Output Format
Using datetime module from datetime import date today = date.today() | YYYY-MM-DD
Using datetime with formatting from datetime import datetime today = datetime.now().strftime('%Y-%m-%d') | YYYY-MM-DD
Using time module import time today = time.strftime('%Y-%m-%d') | YYYY-MM-DD
Using pandas import pandas as pd today = pd.Timestamp.now().strftime('%Y-%m-%d') | YYYY-MM-DD
icaoberg commented 4 months ago

@Az1z4 if you want to include the hour you could use

| Method                         | Code                                                                                          | Output Format     |
|--------------------------------|-----------------------------------------------------------------------------------------------|-------------------|
| Using `datetime` module        | ```python from datetime import datetime today = datetime.now() print(today)```                  | `YYYY-MM-DD HH:MM:SS` |
| Using `datetime` with formatting | ```python from datetime import datetime today = datetime.now().strftime('%Y-%m-%d %H:%M:%S')``` | `YYYY-MM-DD HH:MM:SS` |
| Using `time` module            | ```python import time today = time.strftime('%Y-%m-%d %H:%M:%S')```                            | `YYYY-MM-DD HH:MM:SS` |
| Using `pandas`                 | ```python import pandas as pd today = pd.Timestamp.now().strftime('%Y-%m-%d %H:%M:%S')```      | `YYYY-MM-DD HH:MM:SS` |