diff options
| author | 2019-10-30 10:25:07 +0000 | |
|---|---|---|
| committer | 2019-10-30 10:25:07 +0000 | |
| commit | 3634b72622e0108202482c7de57a7cdb1be35029 (patch) | |
| tree | 76af44c235f42b704b5fd83914dd33b085f7e623 /src/utils | |
| parent | update CHANGELOG.md (diff) | |
| signature | ||
add utils.date_human() - use it in badges.py
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 309186c4..bbf11e73 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -14,6 +14,7 @@ ISO8601_FORMAT_TZ = "%z" DATETIME_HUMAN = "%Y/%m/%d %H:%M:%S" +DATE_HUMAN = "%Y-%m-%d" def datetime_utcnow() -> datetime.datetime: return datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc) @@ -35,6 +36,8 @@ def iso8601_parse(s: str, microseconds: bool=False) -> datetime.datetime: def datetime_human(dt: datetime.datetime): return datetime.datetime.strftime(dt, DATETIME_HUMAN) +def date_human(dt: datetime.datetime): + return datetime.datetime.strftime(dt, DATE_HUMAN) TIME_SECOND = 1 TIME_MINUTE = TIME_SECOND*60 |
