Skip to main content
Filter by
Sorted by
Tagged with
4 votes
1 answer
136 views

I encountered this behaviour and I figured I would ask the correct way to go about it. Here is a toy example: pre_timechange = datetime.datetime(2025, 11, 2, 1, 59, 9, tzinfo=zoneinfo.ZoneInfo(key='...
SomeGuy's user avatar
  • 61
2 votes
1 answer
55 views

I am creating a simple script where I need to convert strings with date and time given in NZ time to corresponding UTC time. The time series are done in NZ summer (Dec-Feb) and hence the NZ time is 13 ...
IgorLopez's user avatar
  • 301
0 votes
1 answer
99 views

As title said, I'm looking for a simple way to get the canonical name of a timezone when providing a timezone name. For example Asia/Calcutta is the backward liked name of Asia/Kolkata. I'd expect ...
Junn Sorran's user avatar
2 votes
2 answers
82 views

I am having trouble identifying whether a ZoneInfo is built with an alias: > a = ZoneInfo('Atlantic/Faeroe') > b = ZoneInfo('Atlantic/Faroe') > a == b False It seems like these ZoneInfos are ...
Janus Troelsen's user avatar
2 votes
2 answers
79 views

I have several local time points: import datetime from zoneinfo import ZoneInfo as zi wmr = datetime.time(hour=12, tzinfo=zi("GMT")) ecb = datetime.time(hour=14, minute=15, tzinfo=zi("...
sds's user avatar
  • 60.5k
0 votes
1 answer
135 views

I have a code where I get date and time of different parts of the world with the datetime and zoneinfo libraries in Python. I am able to extract the dates and hourse separately in day, month, year, ...
Jdavid_Ar08's user avatar
0 votes
1 answer
79 views

I use the same timezone repeatedly in my python code when creating datetime objects. So far I've just been creating a new ZoneInfo object each time, similar to this: dt = datetime.now(tz=ZoneInfo(&...
Yogi88's user avatar
  • 5
1 vote
1 answer
417 views

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 >...
User's user avatar
  • 15k
1 vote
1 answer
2k views

Why are these not equal? >>> from datetime import datetime >>> from datetime import timedelta >>> from datetime import timezone >>> from zoneinfo import ZoneInfo &...
Darren Weber's user avatar
  • 1,714
1 vote
2 answers
306 views

I am running some code using Python 3.8. As it is for a scientific experiment that has already been run in this configuration before, I cannot currently update to a newer version of Python. I am using ...
Emma van Zoelen's user avatar
3 votes
1 answer
681 views

I can easily get a ZoneInfo object for the time zone of my choice: import zoneinfo ct = zoneinfo.ZoneInfo('America/Chicago') I need to create a TZ environment variable for an embedded system that ...
Mark Ransom's user avatar
0 votes
2 answers
127 views

I need to make sure that when a naive datetime is made aware the DST rules are applied correctly. What I find here is just odd to me. Somehow zoneinfo decides to increment the DST transition for ...
Stryder's user avatar
  • 870
-2 votes
1 answer
1k views

My embedded Linux program needs to convert UTC time to local time for a report saved in a text file. The most obvious way to do this is to use the API function strftime(). However... on my system, the ...
f1fan44's user avatar
  • 155
1 vote
1 answer
140 views

I have a pd.DatetimeIndex object in local time without UTC offsets. I am now trying to localize this object using tz_localize and a ZoneInfo object so that it contains UTC offset information, i.e. ...
Markus's user avatar
  • 33
0 votes
0 answers
249 views

I'm writing a calendar application, and I have been trying to track down why canceled / rescheduled calendar entries keep appearing on my calendar. I traced the problem to a time zone issue with ...
David Stein's user avatar
3 votes
1 answer
2k views

I am currently attempting to migrate a code base from using pytz to using Python's zoneinfo library. I've run into an issue with how zoneinfo handles daylight saving time transitions when compared to ...
Paul's user avatar
  • 33
15 votes
1 answer
9k views

pytz is used in the Django version: <=3.2 doc Selecting the current time zone as shown below: import pytz # Here from django.utils import timezone class TimezoneMiddleware: def __init__(self, ...
Super Kai - Kazuya Ito's user avatar
2 votes
0 answers
88 views

Here's an example: import pandas as pd from datetime import datetime, timezone from zoneinfo import ZoneInfo string = '2038-04-01 09:00:00.000000' dt = datetime.fromisoformat(string) dt = dt....
ignoring_gravity's user avatar
0 votes
0 answers
157 views

Currently working on a project where I need to manipulate a particular store's opening and closing times to UTC in Python. The opening and closing times are date independent. For instance , I have a ...
BJay's user avatar
  • 1
4 votes
0 answers
4k views

I am trying to add a timezone to a time without timezone. However, using 2 libraries gives 2 different results: from datetime import datetime import pytz from zoneinfo import ZoneInfo cur = datetime....
Aizaz's user avatar
  • 79
0 votes
0 answers
250 views

I need to compare pytz.timezones for equality, and the behavior I'm observing is quite unintuitive. I've read a lot about Python time zones, pytz, zoneinfo, LMT, etc., both on SO and generally on the ...
Georgi Peev's user avatar
3 votes
1 answer
636 views

I am trying to assign a timezone to a datetime column, based on another column containing the time zone. Example data: DATETIME VALUE TIME_ZONE 0 2021-05-01 00:00:00 1....
oskros's user avatar
  • 3,345
1 vote
3 answers
5k views

Python 3.9 introduced the zoneinfo module: The zoneinfo module provides a concrete time zone implementation to support the IANA time zone database as originally specified in PEP 615. By default, ...
Flimm's user avatar
  • 154k
2 votes
2 answers
708 views

I am trying to use zoneinfo instead of pytz. I am running into a problem using zoneinfo to initiate dates and passing it on to pd.date_range. Below is an example of doing the exact same thing with ...
Aviv Fried's user avatar
1 vote
1 answer
1k views

I'm trying to understand how the zoneinfo module figures out daylight savings time transitions in the distant future while it seems that dateutil and pytz both give up on daylight savings time ...
Michael S.'s user avatar
4 votes
2 answers
9k views

I was trying to convert a datetime from one timezone to another. I'm in the process of updating our Python codebase to stop relying on utilities we don't need anymore. In particular, I'm deprecating ...
jaywhy13's user avatar
  • 1,126
1 vote
1 answer
724 views

I have django model: from django.db import models from timezone_field import TimeZoneField class Client(models.Model): time_zone = TimeZoneField(choices_display='WITH_GMT_OFFSET') And APIView ...
Sergey's user avatar
  • 137
0 votes
1 answer
407 views

I am writing an application that will connect to the Exchange Server and send an email to a recipient on a scheduled basis. This application depends upon a successful import exchanglib. I'm able to ...
AGuler's user avatar
  • 1
0 votes
1 answer
524 views

My web app has a need to very roughly locate the user in order to calculate sunset and sunrise times. Since geolocation features necessarily ask the user for permission, I'm brainstorming other ways ...
John's user avatar
  • 7,119
2 votes
2 answers
786 views

In John Skeet's blog post about handling timezone information when storing future datetimes, he suggests storing the version of timezone rules in the database along with the local time and timezone id....
roob's user avatar
  • 2,559
0 votes
0 answers
927 views

I am migrating away from pytz (the fastest footgun in the west), to ZoneInfo. I am doing a test with timezone Africa/Johannesburg, which is GMT+2 (Note: GMT = UTC). I expect the following to yield the ...
run_the_race's user avatar
  • 2,550
4 votes
2 answers
4k views

I am using Python 3.8, so I am using https://pypi.org/project/backports.zoneinfo/ to get zoneinfo. Django is deprecating the use of pytz so I am performing the change from pytz to zoneinfo With pytz ...
run_the_race's user avatar
  • 2,550
2 votes
2 answers
1k views

I'm trying to convert UTC time to Europe/Warsaw time. Warsaw time is now UTC + 2 hours. I don't know why I get result with time 30 minutes eariler. I'm parsing date from string similar to: 7:27:02 AM ...
user3565923's user avatar
-1 votes
2 answers
215 views

How to convert convert_tz() in mysql to a c# function
Andy's user avatar
  • 1
2 votes
1 answer
319 views

Given a time zone abbreviation, is there a way to get a list of possible time zones? Like IST could mean one of the following: Asia/Kolkata (India) Asia/Tel_Aviv (Israel) Europe/Dublin (Ireland) ...
J...S's user avatar
  • 5,267
2 votes
2 answers
1k views

The most recent zoneinfo database, as maintained by the Internet Assigned Numbers Authority, holds two new prefixes, 'posix' and 'right'. For example where there used to be just Asia/Kolkata the new ...
O. Jones's user avatar
  • 109k
4 votes
3 answers
3k views

In my python project, I'm using exchangelib and I needed to create an exe file. Using pyinstaller --onefile I had UTC errors (in general tzdata)- "No timzone in key UTC". Simplifying all and ...
Fabio Fracassi's user avatar
0 votes
2 answers
232 views

As far as I understood ZoneInfo in python 3.9 fixes the issue of "The year of 2038" problem with DST time issue. But I can see that the timedelta is wrong. Below it should have been 2 hours, ...
guyguyguy12345's user avatar
5 votes
1 answer
1k views

I would like to contruct DST-valid timestamps only using the standard library in Python 3.9 and was hoping this was possible with this version.In my timezone "Europe/Berlin", the DST ...
Fab's user avatar
  • 273
2 votes
2 answers
909 views

cockroach DB issue to start : Fail to initialize the node: unable to load named timezone. I downloaded the zoneinfo.zip and unziped and configured the environment variable ZONEINFO and given into the ...
Alok's user avatar
  • 21
13 votes
3 answers
18k views

Checking out the zoneinfo module in Python 3.9, I was wondering if it also offers a convenient option to retrieve the local time zone (OS setting) on Windows. On GNU/Linux, you can do from datetime ...
FObersteiner's user avatar
  • 26.1k
3 votes
1 answer
6k views

I just used mysql_tzinfo_to_sql to load the zoneinfo database into mysql. They all imported fine. [root@db ~]# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql I have some questions that I can'...
user756659's user avatar
  • 3,522
0 votes
1 answer
158 views

I am on a Debian Stable 9 (stretch), the newly updated TZ database for Africa/Casablanca Table currently states isdst=0 and an offset from UTC of +01. From the DST in Morocco Wiki page https://en....
Quest_Bot_3000's user avatar
2 votes
1 answer
1k views

I have made a date with the CURRENT_TIMESTAMP function in phpmyadmin. And the output value of the hours is wrong by 1hour. I have tried changing it in mysql using the SET TIME_ZONE = '+01:00'; ...
Philip Svenningsen Arnevig's user avatar
3 votes
1 answer
2k views

In a Go program I call time.LoadLocation("Europe/Berlin") and it returns an error saying open /usr/local/go/lib/time/zoneinfo.zip: no such file or directory, even though in the container (running ...
rausch's user avatar
  • 3,408
-2 votes
1 answer
605 views

Currently I am setting time zone GMT+5 on my Linux CentOS 7 machine by linking /etc/localtime to /usr/share/zoneinfo/Etc/GMT-5. I want to create a zone info file for example /usr/share/zoneinfo/Etc/...
Muhammad Charaf's user avatar
10 votes
1 answer
3k views

When I use a custom zoneinfo file for TAI or /usr/share/zoneinfo-leaps and a modified NTP client (currently it just adds 27 seconds; and waits for a time stamp that is about 1 second off) on my ...
RRIDDICC's user avatar
  • 129
3 votes
1 answer
2k views

In Go, you can specify a specific zoneinfo.zip file to be used by adding a ZONEINFO environment variable that points to the specific file you'd like to use for time zone information. This is great as ...
Slotheroo's user avatar
  • 975
0 votes
1 answer
7k views

We have timezone set to IST (Indian Standard Time) to begin with - mysql> show global variables like '%time_zone%'; +------------------+--------+ | Variable_name | Value | +------------------+-...
Sandeepan Nath's user avatar
7 votes
3 answers
11k views

I have several time zone strings in UTC format, such as "UTC+08:00", "UTC-05:00", the question is how can i convert these utc format strings to the java.util.TimeZone in Java? I ...
Jianeng Xu's user avatar