`freeze_time` could accept a timezone argument
See original GitHub issueWhat do you think of having freeze_time
accept a timezone argument:
@freeze_time('2015-03-09 09:00:00', timezone='US/Pacific')
That would require adding pytz to the requirements, which should be fine since most Python projects have it.
Thoughts? I might develop it.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:2
- Comments:19 (7 by maintainers)
Top Results From Across the Web
How do I set or freeze time in python? - Stack Overflow
it seems like it will be more useful than pytz. from zoneinfo import ZoneInfo timeZone_AN=("America/New_York") update. If you want to get a ...
Read more >What would happen if we abolished time zones altogether?
So a small group of academics wants to do away with time zones for good. ... argue the introduction of Universal Time could...
Read more >pandas.DatetimeIndex.tz_localize
This method takes a time zone (tz) naive Datetime Array/Index object and makes this time zone aware. It does not move the time...
Read more >Time - Go Packages
Package time provides functionality for measuring and displaying time. The calendrical calculations always assume a Gregorian calendar, with no leap seconds ...
Read more >Add a Timezone to LocalDateTime with ZonedDateTime in ...
time.Clock. The now() methods in java.time all accept a Clock argument which we can use to refactor our code so it's testable. Here's ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just FYI: one can already pass
freeze_time
a timezone-aware datetime object:(prints
2015-08-18 08:51:50-08:00
)@spulec That’s a shame. While it works, it’s a bit clumsy for an extremely common use case. (I, at least, have zero Python projects that can afford to ignore time zones.)