dates.py 文件源码

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

项目:scriptabit 作者: DC23 项目源码 文件源码
def parse_date_local(date, milliseconds=True):
    """Parses dates from ISO8601 or Epoch formats to a standard datetime object
    in the current local timezone.

    **Note that this function should not be used in time calculations.**
    **It is primarily intended for displaying dates and times to the user.**

    Args:
        date (str): A date string in either iso8601 or Epoch format.
        milliseconds (bool): If True, then epoch times are treated as
            millisecond values, otherwise they are evaluated as seconds.

    Returns:
        datetime: The parsed date time in local time.
    """
    return parse_date_utc(date, milliseconds).astimezone(get_localzone())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号