Skip to content

Timezone problem #16

@marcinpr

Description

@marcinpr

There is a problem to convert times received from get_times() to format "%H:%M:%S %Z" in other time zones than UTC.
I assume that:
sunrise = get_times(date, lat, lon)['sunrise']
saves the sunrise time with local zone instead of UTC.
Maybe the objects returned by get_times should have timezone (UTC) specified?
Please compare:
print(get_times(date, lat, lon)['sunrise'].strftime('%H:%M:%S %Z'))
print(datetime.now().strftime('%H:%M:%S %Z'))
Both gives the answer without timezone info.

How to print the sunrise time, adding timezone info?

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