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
Related rules
- ARC-72 Keep the time zone on every time in Clean code and architecture
- APP-12 Show times in the user's time zone in Web app interface
- APP-13 Keep calendar dates as dates in Web app interface
- LOC-11 Format every date and amount from the reader's locale and zone in Localization
- LOC-26 Writing date formats by hand in Localization
- LOC-22 Store language and time zone as two separate settings in Localization
- LOC-32 Send raw values with standard codes instead of formatted text in Localization
- SEO-21 Show the same date to people and machines in SEO
- DEV-3 Offer JSON output with a stable shape in Developer tools, SDKs and CLIs
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.