time datetime Machine Format
Builds a valid time-element datetime value from a proleptic Gregorian date and optional local/global time. Supports date, local-datetime and global-datetime profiles with years 1 through 999999; no timezone database or date inference is used.
Description
The time element can pair readable text with a machine-readable date or timestamp.
The time element can pair readable text with a machine-readable date or timestamp. Local timestamps omit an offset; global timestamps identify a numeric offset from UTC.1
Builds a valid time-element datetime value from a proleptic Gregorian date and optional local/global time. Supports date, local-datetime and global-datetime profiles with years 1 through 999999; no timezone database or date inference is used.
When to use time datetime Machine Format
Use this for the following task: Builds a valid time-element datetime value from a proleptic Gregorian date and optional local/global time. Supports date, local-datetime and global-datetime profiles with years 1 through 999999; no timezone database or date inference is used.
Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
How to use time datetime Machine Format and understand its results
- Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
- Enter mode, year, month, day, hour, minute, second, millisecond, offsetMinutes using the field table, then run the tool.
- Read datetime. Interpret flags, units, ordering and placeholder values using the rules below.
- Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| mode | Mode | string; choose "date", "local-datetime", "global-datetime" | Required |
| year | Year | integer; minimum 1; maximum 999999 | Required |
| month | Month | integer; minimum 1; maximum 12 | Required |
| day | Day | integer; minimum 1; maximum 31 | Required |
| hour | Hour | integer; minimum 0; maximum 23 | Required |
| minute | Minute | integer; minimum 0; maximum 59 | Required |
| second | Second | integer; minimum 0; maximum 59 | Required |
| millisecond | Millisecond | integer; minimum 0; maximum 999 | Required |
| offsetMinutes | Offset Minutes | integer; minimum -1439; maximum 1439 | Required |
Validate the Gregorian day with the divisible-by-4, century and divisible-by-400 leap-year rules. Pad fields, omit zero milliseconds, trim fractional trailing zeros, and add the supplied offset only in global mode.2
date = YYYY-MM-DD; local = date + T + hh:mm:ss; global = local + Z or signed hh:mm offset This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.
| Output field | Meaning | Value type |
|---|---|---|
| datetime | Datetime | string |
{
"input": {
"mode": "global-datetime",
"year": 2024,
"month": 2,
"day": 29,
"hour": 14,
"minute": 5,
"second": 9,
"millisecond": 120,
"offsetMinutes": 330
},
"output": {
"datetime": "2024-02-29T14:05:09.12+05:30"
}
} Limitations and assumptions
All fields remain required even when a selected mode ignores them. No timezone database, daylight-saving conversion, leap second or inferred date is supplied.
This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.
Alternative or Complementary methods
Choose noscript JS-Disabled Fallback for this operation: Resolves HTML noscript fallback and parser treatment from the HTML parser scripting flag. With scripting enabled contents are text; with scripting disabled contents are markup. XML parsing and full content-model validation are outside this tool. For a complementary task, use Module vs Classic Script Diff Lookup for this operation: Returns standard language facts for module or classic scripts: automatic strict mode, module scope and top-level var global binding. Classic scripts can opt into strict mode separately.
Further background: HTML / accessibility reference: time datetime Machine Format.
References
Similar or alternative tools
- noscript JS-Disabled Fallback
Resolves HTML noscript fallback and parser treatment from the HTML parser scripting flag. With scripting enabled contents are text; with scripting disabled contents are markup. XML parsing and full content-model validation are outside this tool.
- Module vs Classic Script Diff Lookup
Returns standard language facts for module or classic scripts: automatic strict mode, module scope and top-level var global binding. Classic scripts can opt into strict mode separately.