diff options
| author | 2019-04-24 14:32:56 +0100 | |
|---|---|---|
| committer | 2019-04-24 14:32:56 +0100 | |
| commit | e095c56f778629420d3b996c22274839ef8352a2 (patch) | |
| tree | 3fe86066ce2a609aefa1899368f36855dc2f8610 /src/utils/__init__.py | |
| parent | Add Database.servers.get_by_alias, move IRCBot.get_server to (diff) | |
| signature | ||
Record and show when a !to was created
Diffstat (limited to 'src/utils/__init__.py')
| -rw-r--r-- | src/utils/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 0a51493f..b3af3f61 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -6,6 +6,7 @@ class Direction(enum.Enum): Recv = 1 ISO8601_PARSE = "%Y-%m-%dT%H:%M:%S%z" +DATETIME_HUMAN = "%Y/%m/%d %H:%M:%S" def iso8601_format(dt: datetime.datetime, milliseconds: bool=False) -> str: timespec = "seconds" @@ -19,6 +20,9 @@ def iso8601_format_now() -> str: def iso8601_parse(s: str) -> datetime.datetime: return datetime.datetime.strptime(s, ISO8601_PARSE) +def datetime_human(dt: datetime.datetime): + return datetime.datetime.strftime(dt, DATETIME_HUMAN) + TIME_SECOND = 1 TIME_MINUTE = TIME_SECOND*60 TIME_HOUR = TIME_MINUTE*60 |
