Fix

UTC timezone errors in closing line timestamps

Short answer: SportsDataHQ timestamps are UTC and end in Z. The game_date field is the local calendar date, which can differ from the UTC date by a day. Parse every timestamp as UTC, convert once with a named time zone, and select a closing line by its snapshot label, not by the latest time.

The symptoms

Timestamp bugs in line history rarely raise an error. They show up as one of these:

All four have the same cause: a UTC value was treated as local time, or a local date was treated as UTC.

What each field means

We checked these on December 6, 2026 against live responses.

FieldWhereMeaning
captured_at / capturedAtprops rows, odds rowsWhen the line was captured, UTC
scheduled_startprops rowsThe game's scheduled start, UTC
minutes_before_scheduled_startprops rowsscheduled_start minus captured_at, in minutes; negative if captured after the start
startTime / starts_atschedule and gamesThe start time as scheduled, UTC; it is not moved to the actual puck drop or tip
game_date / gameDatemost rowsThe game's local calendar date

Two details cause real bugs. First, the casing is not uniform: props rows use captured_at and odds rows use capturedAt. A parser written for one will return null for the other without complaint. Second, game_date is local. A game on the evening of November 3 in the Eastern time zone has game_date of 2026-11-03 and a scheduled_start of 2026-11-04T00:30:00Z. If you take the first ten characters of the UTC string as the date, you get November 4, and the game lands on the wrong day.

Prices are pre-game only, which is why minutes_before_scheduled_start is meant to be positive. A value near 25 means the line was taken about 25 minutes before the start.

Step 1: parse as UTC and verify against the API's own number

This script pulls two prop rows, parses both timestamps as UTC, recomputes the minutes and checks the result against minutes_before_scheduled_start. Then it pulls the odds for one game and selects the closing rows by label. Set PUCKAPI_API_KEY first. Each call costs 10 credits for props and 10 for one game's odds.

import json, os, urllib.request
from datetime import datetime, timezone

def post(tool, body):
    req = urllib.request.Request(
        f"https://mcp.puckapi.com/v1/{tool}",
        data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json", "x-api-key": os.environ["PUCKAPI_API_KEY"]},
    )
    with urllib.request.urlopen(req, timeout=30) as resp:
        print("HTTP", resp.status, tool)
        return json.load(resp)["data"]

def utc(s):  # every timestamp the API returns ends in Z
    return datetime.fromisoformat(s.replace("Z", "+00:00")).astimezone(timezone.utc)

props = post("get_player_props", {"player_id": 8481721, "from_date": "2026-11-01",
                                  "to_date": "2026-11-05", "market": "player_shots_on_goal"})["props"]
for p in props:
    captured, start = utc(p["captured_at"]), utc(p["scheduled_start"])
    mins = (start - captured).total_seconds() / 60
    print(p["game_date"], "start", start.isoformat(), "captured", captured.isoformat(),
          "computed", round(mins, 1), "reported", p["minutes_before_scheduled_start"])
    assert abs(mins - p["minutes_before_scheduled_start"]) < 0.1

odds = post("get_odds", {"game_id": "2026020239"})["odds"]
closing = [o for o in odds if o["snapshotType"] == "closing"]
print(len(odds), "snapshots,", len(closing), "closing rows")

On the verified run the props call returned 13 rows across two games, one per bookmaker, and every computed value matched the reported one (24.6 and 54.6). The odds call returned 64 snapshots, of which 8 were closing rows, one for each of 8 bookmakers. The other labels were first, opening, earlyam, midday, afternoon, night and latenight, so a single game carries a ladder of captures, not one price.

Step 2: convert with a named zone, never a fixed offset

To turn a local start into UTC, or the reverse, use a time zone database name such as America/New_York. A fixed -05:00 is right for half the year. Daylight saving time ended in the United States on Sunday, November 1, 2026, so the same 7:30pm Eastern start maps to a different UTC hour on either side of that date:

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

ET = ZoneInfo("America/New_York")
for local in ["2026-10-28 19:30", "2026-11-03 19:30"]:   # DST ended Sunday 2026-11-01
    start = datetime.strptime(local, "%Y-%m-%d %H:%M").replace(tzinfo=ET)
    u = start.astimezone(timezone.utc)
    print(f"{local} ET -> {u:%Y-%m-%d %H:%M} UTC (offset {start:%z})  local date {start.date()}  UTC date {u.date()}")

The output shows 23:30 UTC on October 28 and 00:30 UTC on November 4. The first keeps its date, and the second moves to the next UTC day. If you hard-code a four-hour offset you will be an hour off for every game after the change, and the "captured after the start" rows will appear in a cluster.

Step 3: pick the closing line by label

Do not define the close as the row with the greatest captured_at. In our check the latest capture was a closing row, but that is a property of this game, not a rule: a late capture can follow the close in a market that kept moving, and some books post only a final line. Use the labels the API gives you:

After you have selected the row, use minutes_before_scheduled_start as a quality check. A closing line captured 600 minutes before the start is a stale close, and you may want to drop it from a study of late movement.

Step 4: store UTC, derive local dates once

Keep timestamps in UTC in your database, in a timestamp-with-time-zone column or an ISO string. Derive a local date in one place with a named zone, and keep the API's game_date next to it for cross-checks. Group by game_date when you mean "games on that calendar day", and group by UTC time only when you mean an exact moment. Mixing the two is the source of most off-by-one-day joins.

When not to use this

This page is about timestamps. It does not rank lines or suggest any wager.

Get a free key

Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.