Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Date, DateTime, and Time Formats: ISO 8601, Schema.org, and HTML

How to format Date, DateTime, and Time values for Schema.org, HTML inputs, APIs, and structured data, including timezones and common mistakes.

Most of this cluster comes from Schema.org property definitions, which declare whether each temporal field accepts Date, DateTime, or Time. In practice those values are almost always written as ISO 8601 strings in JSON-LD or microdata. Google Search structured data and Cloudflare Analytics SQL document stricter rules for timezones and literals, and HTML defines valid date and time microsyntax for form controls and attributes.

Schema.org Date, DateTime, and Time: which type does a property expect?

Section titled “Schema.org Date, DateTime, and Time: which type does a property expect?”

Schema.org temporal properties are typed as Date (calendar day or broader), DateTime (date plus time, usually with timezone), or Time (clock time without a calendar date). The expected type is listed on each property page under “Values expected to be one of these types.”

Kind of value Typical use Example properties (type only)
Date Day-level facts birthDate, datePublished (also allows DateTime), priceValidUntil
DateTime Instant or local date-time bookingTime, timestamp, validFrom
Time Opening hours, cutoffs opens, closes, cutoffTime
Date and DateTime Either precision is OK startDate, endDate, availabilityStarts
DateTime and Time Time of day, optionally with date checkinTime, departureTime

Many content and lifecycle fields allow both calendar dates and full date-times, for example dateCreated, dateModified, and datePosted accept Date and DateTime. Range and validity fields such as validThrough and expires follow the same pattern. Properties that are only DateTime include dateSent, modifiedTime, and pickupTime.

DayOfWeek appears on dayOfWeek and optionally as Text on byDay; that is separate from Date/Time string formats. merchantReturnDays unusually allows Date, DateTime, or Integer—a day count is not the same as an ISO date string.

For markup, use the narrowest type that matches the fact: a publication day is often 2019-07-10; an exact post time should be DateTime in ISO 8601, as Google’s discussion forum structured data requires for datePublished.

ISO 8601 strings: the format APIs and rich results expect

Section titled “ISO 8601 strings: the format APIs and rich results expect”

ISO 8601 is the shared string format for Date and DateTime in JSON-LD, analytics queries, and Google’s examples. Cloudflare’s documentation style guide recommends ISO-8601 (YYYY-MM-DD hh:mm:ss) for product content and charts when a machine-readable value is needed.

A date-only value is typically YYYY-MM-DD, for example 2019-07-10. In Google’s event guidelines, a bare date “means the date regardless of the timezone”; for startDate the event starts sometime on that calendar day in the event’s location, and for endDate it ends sometime on that day.

Combine date and time with T (common) or a space, and include a timezone offset or Z for UTC when consumers require it. Cloudflare’s SQL API states:

Use an ISO 8601 timestamp with a timezone:

timestamp >= ‘2026-09-15T08:30:00Z’ timestamp >= ‘2026-09-15T10:30:00+02:00’

The API normalizes timestamp values to UTC. A date without a time is interpreted as midnight UTC:

timestamp >= ‘2026-09-15’

A date and time without a timezone is rejected. For example, do not use ‘2026-09-15T08:30:00’.

Cloudflare D1 Time Travel accepts Unix timestamps (UTC) or a JavaScript-style ISO-8601 string such as 2023-07-27T11:18:53.000-04:00.

Properties like opens and closes expect Time (for example a time of day in ISO time format). Pair them with a DayOfWeek or schedule context on the parent type rather than inventing a dummy date unless the schema you use requires it.

For HTML input values and related microsyntax, the WHATWG HTML living standard defines “vaguer moments in time” as:

A string is a valid date string with optional time if it is also one of the following:

A valid date string A valid global date and time string

Browser validation for type="date", type="time", and type="datetime-local" follows these rules. They align conceptually with ISO-like strings but are not identical to every Schema.org or API rule (for example datetime-local has no timezone field). For structured data on the page, still follow Schema.org and Google timezone guidance rather than only the input element’s local value.

Google Event and forum datePublished: timezones and interpretation

Section titled “Google Event and forum datePublished: timezones and interpretation”

When implementing startDate, endDate, and previousStartDate in Event structured data, Google’s date and time guidelines apply.

Specify the timezone by including the UTC or GMT time offset. If the event starts at 7pm on September 5 in New York, the startDate value would be GMT/UTC-5 during standard time and GMT/UTC-4 during daylight savings time. During standard time, startDate value would be “2019-09-05T19:00:00-05:00” or “2019-09-05T19:00:00-04:00” respectively. If no timezone is provided, Google uses the timezone of the event’s location as specified in location.

Google documents several interpretations in Event structured data:

Value you provide Google’s reading (summary)
2019-08-15T00:00:00+00:00 Shifts to local time at the event location (e.g. California or Korea in their examples).
2019-08-15T23:59:59+00:00 Not “end of that UTC day” globally; converted using event location.
2019-07-10 Calendar date in the event location; start or end “sometime” that day.
2019-07-20T00:00:00 Midnight in the event’s timezone; “also likely wrong unless the event was meant to start at midnight.”

For Discussion forum posting markup, datePublished on posts and comments is DateTime: “The date and time the post was made in ISO 8601 format.” Comments use the comment time in ISO 8601; you need not duplicate the publish date if nothing changed.

Cloudflare Analytics: querying and formatting timestamps

Section titled “Cloudflare Analytics: querying and formatting timestamps”

Beyond literal rules in Data types and literals, GraphQL examples use ISO strings such as 2018-01-01T10:00:00Z in Filtering. For stable ordering, GraphQL FAQ on inconsistent results recommends orderBy: [datetime_ASC].

Date and time functions include now() (current DateTime), today() (current Date), and formatDateTime() to print a datetime with a format string and optional timezone (ClickHouse-style format tokens). Example from the docs:

formatDateTime(now(), '%Y-%m-%d')

Basin SQL scalar functions expose current_date() (alias today) for today’s date in queries.

When a date is not a string: API object dates and Unix time

Section titled “When a date is not a string: API object dates and Unix time”

Not every API uses ISO strings. The Chrome Web Store publishers.items.queryMetrics TimeSpec uses structured Date objects:

Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant.

JSON form: { "year": integer, "month": integer, "day": integer } with rules for partial dates (year-only, year-month, and so on). That is the protobuf-style Date message, not YYYY-MM-DD text.

Brave Search Web Search API documentation mentions Unix timestamp conversion utilities. Unix seconds since 1970 UTC also appear in D1 Time Travel as an alternative to ISO-8601 strings.

Cloudflare Durable Object State can return “A Date or null” in JavaScript—runtime Date objects, not Schema.org literals.

Common mistakes when setting dates and times

Section titled “Common mistakes when setting dates and times”
  • Date-time without timezone in Cloudflare SQL — Rejected; add Z or an offset (Data types and literals).
  • Assuming UTC midnight means “that day everywhere” — Google converts using event location.
  • Using T00:00:00 without offset for live events — Google warns this is often unintended unless the event truly starts at local midnight.
  • Wrong Schema.org precision — Putting only a Time in a property that expects DateTime, or using Date when you need the exact instant of a forum post (datePublished guidance).
  • Mixing API date models — Sending ISO strings to an endpoint that expects {year, month, day} (queryMetrics Date).
  1. Open Google Rich Results Test or Search Console rich-result reports for Event or DiscussionForumPosting URLs and confirm startDate, endDate, and datePublished validate and show intended local times.

  2. Paste JSON-LD into the validator and cross-check each temporal property against its Schema.org type (Date vs DateTime vs Time).

  3. Run a sample Cloudflare Analytics SQL query with your timestamp literals; confirm date-only and offset forms are accepted and that bare YYYY-MM-DDTHH:mm:ss without a zone is not used.

  4. For HTML forms, test input values against the constraints in Common microsyntaxes so user-entered dates parse in target browsers.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will correct or clarify it.