Skip to content

strptime returns incorrect timestamp when reading year before day of year #14618

@skovati

Description

@skovati

What happens?

When using strptime to read timestamps, if the timestamp string (and consequently the format string) has the year before the day of year, the resulting timestamp object will be incorrect and entirely disregard the day of year.

If the year appears after the day of year number, the resulting timestamp is correct.

To Reproduce

The following two SQL queries in the duckdb CLI minimally reproduce the issue:

Correct timestamp returned

select strptime('100 2024', '%j %Y');

Incorrect timestamp returned

select strptime('2024 100', '%Y %j');

OS:

macOS 14.7, aarch64

DuckDB Version:

v1.1.2

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Luke Johnson

Affiliation:

NASA

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions