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

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

def parse_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')