镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

datetime_tz.fromtimestamp has no optional tz parameter #5

Open

Description

@io41

As a drop-in replacement for the std lib datetime module I was surprised that the datetime_tz.fromtimestamp method doesn't allow an optional tz parameter like it's standard library counterpart.

Was this an intentional omission?

Activity

  1. mithro commented on Mar 4, 2014

    @mithro
    Owner

    I think it may have been an oversight, the tz parameter is however a little confusing. POSIX timestamps are always in UTC, which means the two are equivalent;

    datetime_tz.fromtimestamp(ts, "US/Pacific")
    # is identical to
    datetime_tz.fromtimestamp(ts).astimezone("US/Pacific")

    It will probably take me a while to fix the issue myself, I'd welcome patches though!

  2. added a commit that references this issue on Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions