TOML dates and times: four distinct types
TOML reads dates and times as their own value types, not as strings. So 2026-11-30 and "2026-11-30" are different: the first is a local date, the second is just text. The difference shows up as soon as the document is converted to JSON or YAML.
The four types
| Type | Example | Meaning |
|---|---|---|
| Offset date-time | 2026-11-30T07:30:00+09:00 | an instant with its difference from UTC |
| Local date-time | 2026-11-30T07:30:00 | a date and time with no time zone |
| Local date | 2026-11-30 | a date only |
| Local time | 07:30:00.250 | a time only |
The offset is written as Z for UTC or as +HH:MM / -HH:MM. +09:00 is Korea Standard Time; -05:00 is US Eastern Standard Time. Without an offset the value is a local date-time.
created = 2026-11-30T07:30:00Z local = 2026-11-30T07:30:00 kst = 2026-11-30T07:30:00+09:00 day = 2026-11-30 clock = 07:30:00
T or a single space between date and time
A date and a time may be separated by T, t or one space. 2026-11-30 07:30:00 is a valid local date-time. Lower-case t and z are allowed, but upper case is safer when data travels between tools.
Fractional seconds
Seconds may carry a decimal fraction. The specification does not limit the number of digits, though many implementations keep microseconds (six digits). This tool keeps six digits and reads the rest, so .5 and .250 compare as the same 0.25 second.
Seconds run from 00 to 59. Leap second 60 is not in the specification's grammar, so this tool rejects it. Offset hours run 00 to 23 and offset minutes 00 to 59.
Calendar validation
A correctly shaped date can still be invalid. 2026-02-30, 2026-13-01 and 2025-02-29 are all refused. A leap year is divisible by 4, and a century year only if it is divisible by 400, so 2024 and 2028 are leap years and 2100 is not.
Going to JSON and YAML
JSON has no date type, so a TOML date-time becomes an ISO 8601 string there. The YAML core schema has no date type either, so the same applies. This tool warns that dates become strings, and never reinterprets a string as a date on the way back.
TOML: released = 2026-11-30T07:30:00+09:00 JSON: "released": "2026-11-30T07:30:00+09:00"
Reviving a date when converting JSON to TOML would mean guessing from the text, and guessing is risky: the postcode 02134 or the version 1.2.3 could be turned into a date. Set the type by hand after conversion when it matters.
What to check in practice
- Whether a log timestamp is UTC or local. Without an offset there is no way to tell.
- Whether one file mixes
Zand+00:00for the same meaning. - Whether tools truncate fractional seconds differently, so comparisons drift.
- Whether a field that only needs a date also carries a time, breaking equality checks.
Questions
Can I use a space instead of T?
Yes. TOML allows T, t or one space between the date and the time. For data that moves between languages, T is the safer choice.
Is a time without an offset UTC?
No. A local date-time has no time zone at all. To mean UTC, write an offset date-time with <code>Z</code>.
What changes if I write the date as a string?
The value becomes text, so sorting, comparison and conversion work character by character. TOML tools will not recognise it as a date, and schema checks may reject it.
Paste a document with dates and watch the type table separate offset from local values.
Open the toolThese guides follow the TOML v1.0.0 specification (2021-01-11), RFC 3339 (dates and times), the YAML 1.2 core schema and JSON (RFC 8259). Every example is synthetic.