ISO date-time truncate
iso-datetime-truncate · version 1.0.0 · Dates & times (UTC, ISO 8601) · free, no key needed
Truncate a strict UTC ISO-8601 datetime toward UTC zero at day, hour, minute, or second.
Use when you need to: iso datetime truncate · truncate utc datetime · floor iso datetime to unit.
Supported
- iso datetime truncate
- truncate utc datetime
- floor iso datetime to unit
Not supported
- round or ceil
- truncate to week, month, or year
- leap seconds
- time zones
- offsets other than Z
- fractional seconds
- locale
- DST
Behavior
- datetime must match YYYY-MM-DDTHH:MM:SSZ with zero-padded fields and a real proleptic Gregorian UTC civil time.
- Years are 0001-9999. Days are linear 86400-second POSIX days. There are no leap seconds, fractional seconds, space separators, or offsets other than Z.
- unit must be exactly day, hour, minute, or second.
- Truncation zeros smaller fields toward UTC zero: day to T00:00:00Z, hour to HH:00:00Z, minute to HH:MM:00Z, second is identity.
- The result is formatted YYYY-MM-DDTHH:MM:SSZ and stays on the same calendar date as the input.
Input
datetime(string, required): min length 20; max length 20; pattern^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$unit(one of "day", "hour", "minute", "second", required)
Output
datetime(string, required): min length 20; max length 20; pattern^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$
Limits
- min year: 1
- max year: 9999
- units: ["day","hour","minute","second"]
Example
Request input:
{
"datetime": "2026-09-11T12:34:56Z",
"unit": "hour"
}
Response:
{
"result": {
"datetime": "2026-09-11T12:00:00Z"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "iso-datetime-truncate",
"version": "1.0.0",
"input": {
"datetime": "2026-09-11T12:34:56Z",
"unit": "hour"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/iso-datetime-truncate/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"datetime":"2026-09-11T12:34:56Z","unit":"hour"}'
The machine-readable contract is at /v1/tools/iso-datetime-truncate/versions/1.0.0.
CLI
node cli.mjs run iso-datetime-truncate 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- ISO date-time add seconds: Add a signed whole-second delta to a strict UTC ISO-8601 datetime.
- ISO date-time clamp: Clamp a strict UTC ISO-8601 datetime into an inclusive [min, max] range.
- ISO date-time compare: Compare two strict UTC ISO-8601 datetimes and return -1, 0, or 1.
- ISO date-time diff seconds: Return the signed whole-second difference between two strict UTC ISO-8601 datetimes.
- ISO date add: Add a signed whole-day delta to a strict YYYY-MM-DD calendar date.
- ISO date add months: Add a signed month count to a YYYY-MM-DD date, clamping the day to the target month.