oracle / oracle/graalpython

[Bug]: datetime.strptime is broken

Open
#1,013 3 comments 0 reactions 1 assignee View on GitHub

@msimacek is already working on this.

Since Jul 13, 2026.

bug
Dominant language
Python
Stars
1.6k
Forks
155
Avg merge
9h 42m
Merged PRs (30d)
36

Description

Describe the bug

Initially, I was thinking that this bug is related to https://github.com/oracle/graalpython/issues/532

But I think it is not. I tested it with the timezone "Europe/Berlin/ which has DST, but the result is the same.

The following code produces the following output

from java.time import ZoneId
from datetime import datetime

print("User Timezone (from -Duser.timezone) " + ZoneId.systemDefault().getId())
start_time = datetime.strptime("2025-09-26 10:00:00", "%Y-%m-%d %H:%M:%S")
print("User Timezone (from -Duser.timezone) " + ZoneId.systemDefault().getId())
2026-07-13 08:59:02.542 [INFO ] [nhab.automation.pythonscripting.test] - User Timezone (from -Duser.timezone) Europe/Berlin
2026-07-13 08:59:02.723 [INFO ] [nhab.automation.pythonscripting.test] - User Timezone (from -Duser.timezone) Etc/UTC

Any subsequent call to the timezone returns only UTC.

I tested this using GraalPy 25.0.1.

Operating system

Linux

CPU architecture

x86_64

GraalPy version

25.0.1

JDK version

No response

Context configuration

No response

Steps to reproduce
from java.time import ZoneId
from datetime import datetime

print("User Timezone (from -Duser.timezone) " + ZoneId.systemDefault().getId())
start_time = datetime.strptime("2025-09-26 10:00:00", "%Y-%m-%d %H:%M:%S")
print("User Timezone (from -Duser.timezone) " + ZoneId.systemDefault().getId())
2026-07-13 08:59:02.542 [INFO ] [nhab.automation.pythonscripting.test] - User Timezone (from -Duser.timezone) Europe/Berlin
2026-07-13 08:59:02.723 [INFO ] [nhab.automation.pythonscripting.test] - User Timezone (from -Duser.timezone) Etc/UTC
Expected behavior

don't change the system timezone

Stack trace

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.