API Error: Invalid date format — expected ISO 8601 (YYYY-MM-DDTHH:mm:ssZ)
A date or timestamp in the request isn’t in the format the API expects — usually ISO 8601 with a time zone, or a Unix timestamp.
Meaning
Dates are a classic source of 400/422 errors. Locale formats like 03/10/2026 are ambiguous, “2026-10-03 14:00” lacks the T separator and time zone, and some APIs want seconds since epoch while others want milliseconds or an RFC 3339 string.
Validators say things like “must match format "date-time"”, “Invalid datetime”, “Input should be a valid datetime” (Pydantic) or “Cannot deserialize value of type LocalDateTime” (Jackson).
Common causes
- Locale-formatted string (dd/mm/yyyy, mm/dd/yyyy)
- Missing T separator or time zone/offset
- Milliseconds sent where the API expects seconds (or vice versa)
- Date object serialized in a non-standard way
- Invalid offset like +5:30 instead of +05:30
⚡ Quick fix
- Send ISO 8601/RFC 3339 strings in UTC: 2026-10-03T14:00:00Z
- Use toISOString() / isoformat() instead of formatting by hand
- Check whether the API wants seconds or milliseconds
Detailed fix by platform
Node.js
- javascript
const body = { start: new Date(start).toISOString() }; // 2026-10-03T14:00:00.000Z const unix = Math.floor(Date.now() / 1000); // seconds, not ms
Python
- python
from datetime import datetime, timezone datetime.now(timezone.utc).isoformat() # '2026-10-03T14:00:00+00:00'
How to diagnose
- Raw value — Exact string sent
- Docs — ISO string, date-only, seconds or ms?
- Time zone — Present and well-formed?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Report a correction or suggest an improvement
Last updated 7 Oct 2026