Floor datetime to a minute or second interval in UTC
Floor a timezone-qualified ISO datetime to the beginning of a repeatable minute or second bucket.
Run — free
The calculation first resolves the supplied Z value or numeric offset to UTC, then rounds downward to a multiple of the requested interval measured from the Unix epoch. It uses only the datetime, interval, and unit you provide. That makes the result suitable for stable event grouping, cache keys, reporting windows, and test fixtures without consulting a clock, locale, network service, or machine timezone.
Choose an explicit instant and interval
Provide a complete ISO-8601 datetime containing a calendar date, hours, minutes, seconds, and either Z or a numeric UTC offset. Requiring the offset is important because a local wall-clock reading alone does not identify one instant. For example, 09:30 in New York and 09:30 in London are different points on the timeline. Then provide a positive whole-number interval and select minute or second as its unit. A 15-minute interval creates buckets at predictable UTC boundaries, while a 20-second interval is useful for denser event streams. Minute values may range from 1 through 1440 and second values from 1 through 86400, keeping every request bounded to at most one day. Fractional seconds are accepted as part of the explicit datetime; flooring operates at whole-second precision, so any fraction is necessarily removed. The response echoes the input settings, shows the normalized UTC instant, and returns both the floored UTC datetime and its integer Unix timestamp so downstream code can use whichever representation is more convenient.
Understand the UTC flooring rule
The operation converts the supplied datetime to an integer count of seconds relative to 1970-01-01T00:00:00Z. It converts the chosen interval to seconds and applies mathematical floor division, then multiplies back by the interval size. This is a true floor, not rounding to the nearest boundary: 14:37:52Z floored to 15 minutes becomes 14:30:00Z, never 14:45:00Z. Boundaries are anchored to the Unix epoch, which removes ambiguity for intervals that do not divide an hour evenly. A seven-minute interval, for instance, follows consecutive seven-minute multiples on the global UTC timeline instead of restarting according to an unstated local convention. Mathematical floor also matters for instants before 1970 because it moves toward the earlier boundary rather than truncating toward zero. Numeric timezone offsets are resolved before the bucket is selected, so equivalent representations of the same instant produce the same floored result. The implementation validates Gregorian dates and clock fields directly and performs civil-calendar conversion with integer arithmetic; it never invokes the host Date object or inherits the host timezone.
Use stable buckets in automated systems
A floored datetime is a compact, explainable bucket key. Analytics pipelines can group incoming records into identical windows before aggregation. Caches can derive expiration groups without letting milliseconds or client timezone settings fragment otherwise equivalent keys. Monitoring systems can normalize observations to a fixed cadence, and test suites can assert exact boundaries without freezing a system clock. Store the returned floored_datetime when people or logs need a readable UTC value, or use floored_epoch_seconds for numeric comparisons and database indexes. Because the result depends only on the three input fields, retrying a request produces the same object and processing records out of order does not alter earlier answers. The API price is $0.002 per item, while the browser runner can execute the same pure calculation locally. This capability deliberately does not infer a timezone, read the current time, perform calendar-aware month bucketing, or round upward. If your business boundary is based on a named timezone with daylight-saving transitions, resolve that rule before calling this tool and pass the resulting explicit ISO offset.
What you can do with it
Group events into reporting windows
Convert differently offset ISO timestamps to consistent UTC bucket starts before counting or summing records.
Build deterministic cache keys
Remove sub-interval timestamp variation so requests in the same fixed window share one stable key.
Create exact test fixtures
Assert minute or second boundary behavior without using the machine clock, locale, or timezone database.
FAQ
What does one request cost?
The API price is $0.002 per item. The browser runner performs the same deterministic calculation locally.
Why must the datetime include Z or an offset?
A clock reading without a timezone does not identify a unique instant. An explicit offset makes UTC conversion deterministic.
Does this round to the nearest interval?
No. It always floors to the earlier interval boundary, including for timestamps before the Unix epoch.
What happens to fractional seconds?
They are accepted, but the capability floors at whole-second precision, so the returned UTC values contain no fraction.
Where are interval boundaries anchored?
They are exact multiples of the interval in seconds from the Unix epoch, 1970-01-01T00:00:00Z.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/date/floor-to-interval \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"datetime":"2026-07-25T14:37:52Z","interval":15,"unit":"minute"}'const res = await fetch("https://api.kit.forhosting.com/date/floor-to-interval", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"datetime": "2026-07-25T14:37:52Z",
"interval": 15,
"unit": "minute"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/date/floor-to-interval",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"datetime": "2026-07-25T14:37:52Z",
"interval": 15,
"unit": "minute"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/date/floor-to-interval", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"datetime":"2026-07-25T14:37:52Z","interval":15,"unit":"minute"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"datetime":"2026-07-25T14:37:52Z","interval":15,"unit":"minute"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/date/floor-to-interval", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"datetime": "2026-07-25T14:37:52Z",
"interval": 15,
"unit": "minute"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "date.floor_to_interval",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |