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

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter mode, year, month, day, hour, minute, second, millisecond, offsetMinutes using the field table, then run the tool.
  3. Read datetime. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
modeModestring; choose "date", "local-datetime", "global-datetime"Required
yearYearinteger; minimum 1; maximum 999999Required
monthMonthinteger; minimum 1; maximum 12Required
dayDayinteger; minimum 1; maximum 31Required
hourHourinteger; minimum 0; maximum 23Required
minuteMinuteinteger; minimum 0; maximum 59Required
secondSecondinteger; minimum 0; maximum 59Required
millisecondMillisecondinteger; minimum 0; maximum 999Required
offsetMinutesOffset Minutesinteger; minimum -1439; maximum 1439Required

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 fieldMeaningValue type
datetimeDatetimestring
json
{
  "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

  1. HTML / accessibility reference: time datetime Machine Format — WHATWG

  2. time datetime Machine Format — tool.io

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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies