Skip to content

[C++] interval_between(timestamptz, timestamptz) -> struct kernel #18858

Description

@asfimport

Given two timestamps that each have time zones this function should return an interval from the first timestamp to the second timestamp according to the following rules (postgres rules):

  • 1 day is 24 physical hours (which may not exactly equal 1 calendar day).

  • Intervals returned will never contain a months/years field

    Examples:

    interval_between('2021-03-14 00:00:00 America/Denver', '2021-03-15 00:00:00 America/Denver') => { "hours": 23 }
    interval_between('2021-03-14 00:00:00 UTC', '2021-03-15 00:00:00 UTC') => { "days": 1}
    interval_between('2021-03-14 00:00:00 UTC', '2020-03-14 00:00:00 UTC') => { "days": 365}

    If the first timestamp is larger than the second timestamp then the interval will be negative.

Reporter: Weston Pace / @westonpace
Assignee: Rok Mihevc / @rok
Watchers: Rok Mihevc / @rok

PRs and other links:

Note: This issue was originally created as ARROW-14108. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions