Agent Wranglers

API-7Recommended

Send dates as RFC 3339 with a time zone

Write every moment in time as an RFC 3339 string with a zone or offset. Write a calendar date with no time as YYYY-MM-DD.

How to do it

Store and send instants in UTC, such as 2026-11-03T09:00:00Z. Send the user's IANA time zone as a separate field when local time matters, such as Europe/Stockholm. Never send local times without an offset, or numbers that might be seconds or milliseconds. Refuse abbreviations such as EST as a time zone. Many resolve to a zone without summer time, so local times come out an hour off for half the year.

Examples

JSON example

{ "deliveredAt": "2026-11-03T09:00:00Z", "deliveryDate": "2026-11-03", "timeZone": "Europe/Stockholm" }

JavaScript example

const deliveredAt = new Date().toISOString()

Python example

from datetime import datetime, timezone

delivered_at = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")

How to check

Turn on format checks in the validator. A JSON Schema with format: date-time validates every response in the contract tests, and no timestamp lacks Z or an offset. A request with the time zone EST gets a 400 that names the place form, such as America/New_York.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/requests-and-responses/dates-and-times">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.