roboluke-tasks/app/utils/datetime.py
Luke Tainton 123ed8aa15
Add APM (#184)
* Add APM
* Fix unit tests
* Remove apm.py
* Add SonarCloud recommendations
* SonarCloud python:S6890
2024-04-21 16:17:00 +01:00

19 lines
396 B
Python

#!/usr/bin/env python3
from zoneinfo import ZoneInfo
from datetime import datetime
def timestamp_to_date(timestamp: int) -> str:
"""Convert timestamp to date.
Args:
timestamp (int): Timestamp to convert.
Returns:
str: Date in the format YYYY-MM-DD.
"""
return datetime.fromtimestamp(timestamp=timestamp, tz=ZoneInfo("UTC")).strftime("%Y-%m-%d")