Created
December 17, 2021 21:03
-
-
Save brandon-wallace/9083cd0f2815896b6e827590acfdd759 to your computer and use it in GitHub Desktop.
Display Amount Of Time Passed Since A Date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
def datetime_format(value, format="%Y-%m-%d %H:%M"): | |
'''Date time''' | |
time_passed = datetime.utcnow() - timedelta(years=value.year, months=value.month, days=value.day, hours=value.hour, minutes=value.minute) | |
return time_passed.strftime(format) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment