utils.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:arq 作者: samuelcolvin 项目源码 文件源码
def from_unix_ms(ms: int, utcoffset: int=None) -> datetime:
    """
    convert int to a datetime.

    :param ms: number of milliseconds since 1970
    :param utcoffset: if set a timezone i added to the datime based on the offset in seconds.
    :return: datetime - including timezone if utcoffset is not None, else timezone naïve
    """
    dt = EPOCH + timedelta(milliseconds=ms)
    if utcoffset is not None:
        dt = dt.replace(tzinfo=create_tz(utcoffset))
    return dt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号