GitHub

layout api-command
language Python
permalink api/python/in_timezone/
command in_timezone
related_commands
timezone now time

timezone/

now/

time/

Command syntax

{% apibody %} time.in_timezone(timezone) → time {% endapibody %}

Description

Return a new time object with a different timezone. While the time stays the same, the results returned by methods such as hours() will change since they take the timezone into account. The timezone argument has to be of the ISO 8601 format.

Example: Hour of the day in San Francisco (UTC/GMT -8, without daylight saving time).

r.now().in_timezone('-08:00').hours().run(conn)

Read the original on github.com ↗