733 questions
0
votes
0
answers
49
views
pytz library timezone conversion issue [duplicate]
I am trying to work with django and converting timezones between UTC and my timezone ("America/Winnipeg"), but I keep running into issues and I think there might be a bug. Here is my code:
#...
0
votes
1
answer
46
views
Rendering datetime and proper formatting
I have a Django project to keep track of tasks in an office environment. I have this model for tasks, and it has a finish_date attribute that is assigned as soon as I access the route to do the ...
1
vote
2
answers
70
views
In python (pytz), how can I add a "day" to a datetime in a DST-aware fashion? (Sometimes the result should be 23 or 25 hours in in the future)
I'm doing some datetime math in python with the pytz library (although I'm open to using other libraries if necessary). I have an iterator that needs to increase by one day for each iteration of the ...
0
votes
1
answer
31
views
use closing hours by default
Using this piece of the pytz script,
import dateutil
import pytz
utc = pytz.UTC
print(utc.localize(dateutil.parser.parse('2024-10-31')))
the output shows:
2024-10-31 00:00:00+00:00
We want to ...
1
vote
0
answers
43
views
Possible faulty python datetime/pytz module behaviour [duplicate]
I think there may be a problem with the pytz/datetime module in python. Either that or I am not using it correctly.
Please look at the coding below which highlights the issues I'm currently facing. I'...
0
votes
0
answers
57
views
pandas timezones conversion malfunction [duplicate]
Trying to build an algorithm for processing stocks. I'm not a dev, so basically my knowledge is limited.
I'm retrieving findata with an API. Looks like it's done correctly, sorted ascending. First ...
0
votes
1
answer
67
views
Python's America/New_York time offset showing -04:56 [duplicate]
I'm currently using Python 3.9.6 and have this simple code
import datetime
import pytz
est = pytz.timezone('America/New_York')
myDateTime = datetime.datetime(year=2024, month=8, day=15, hour=17, ...
1
vote
1
answer
63
views
Datetime doesn't seem to be converting
I am trying to cast from a 'created_at' value in UTC to a value in Eastern Time. But after converting the time using astimezone, the time is the same and raises the assert error that the two times are ...
0
votes
0
answers
42
views
Unexpected difference when subtracting the same time from two different time zones? Python [duplicate]
The total second difference between 2 datetime objects set in different time zones but on the same date does not yield 0.0 in some circumstances.
import datetime
from pytz import timezone
from ...
1
vote
1
answer
285
views
zoneinfo is missing timezone names that pytz has
I am comparing the timezone names that pytz and zoneinfo support because I would like to transition to zoneinfo from pytz.
It seems that zoneinfo lacks a lot of timezones:
>>> import pytz
>...
2
votes
1
answer
58
views
How to get the epoch value for any given Local Time with Time Zone & Daylight Saving Time in Python?
I'm new to Python and I have a use case which deals with datetime. Unfortunately, the data is not in UTC, so I have to rely on Local Time, Time Zones & Daylight Savings. I tried with datetime &...
0
votes
0
answers
35
views
Issues with pytz.timezone in threading.Thread
I ran across an interesting bug yesterday with using pytz.timezone in a threading.Thread. When running the example code below, the Consumer.run() method appears to crash after the 1st iteration i.e., ...
0
votes
1
answer
854
views
Python UTC America/New York Time Conversion
Working on a problem where I have to evaluate whether a time stamp (UTC) exceeds 7PM Americas/New_York.
I naively did my check as:
if (timestamp - timedelta(hours=4)).time() > 19:
__logic__
...
0
votes
1
answer
197
views
mktime resulting in OverflowError: mktime argument out of range
When attempting to get a time using mktime, I get a overflow exception. This occurs on a Debian docker image, but not on my host machine:
docker pull python:3.9.7
https://hub.docker.com/layers/...
1
vote
1
answer
68
views
Handling Local Time in Python Worldwide
I am working on an application in which events occur at specific times. The event creator can create events in a time zone where daylight saving time might or might not be applicable. Therefore, the ...