summaryrefslogtreecommitdiff
path: root/src/portal/py/modules/common.py
blob: 3b878849183d612874120ef3872c8d83d8efc884 (plain)
1
2
3
4
5
6
7
8
9
from datetime import datetime, timezone

def reformat_pixiv_date(date_str: str) -> datetime:
    rindex = date_str.rfind(':')
    date_str = date_str[:rindex] + date_str[rindex + 1:]
    return datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%S%z")

def get_current_utc_time() -> datetime:
    return datetime.now(timezone.utc)