# datetime/v1 — Current date and time

Returns the actual current date/time. An LLM has a training cutoff and no
live clock, so it can't know what time it actually is right now, only
guess from context; this endpoint returns the real value.

This is the one live, non-deterministic endpoint in this API — everything
in [datemath](../../datemath/v1/README.md) is pure calendar-date
arithmetic over dates you supply, with no wall-clock dependency at all.
Keeping "now" separate from datemath keeps that module's own scope
honest.

### `GET /v1/datetime/now`

Query parameters, both optional:

- `format` — one of `iso8601` (default), `unix`, `unixmilli`, `rfc1123`.
- `timezone` — an IANA timezone name (e.g. `Europe/Warsaw`, `America/New_York`). Default `UTC`.

**Response**

```json
{ "value": "2026-09-27T14:32:01Z", "format": "iso8601", "timezone": "UTC" }
```

`value` is a string for `iso8601`/`rfc1123`, a number (seconds or
milliseconds since the Unix epoch) for `unix`/`unixmilli`.

**Error response**

```json
{ "error": "invalid timezone \"Europe/Nowhere\": unknown time zone Europe/Nowhere" }
```

**Example**

```bash
curl -s "https://apished.com/v1/datetime/now?format=unix&timezone=Europe/Warsaw"
# {"value":1758980... ,"format":"unix","timezone":"Europe/Warsaw"}
```

## Out of scope

Parsing/formatting arbitrary dates, or converting a given time between
timezones — that's calendar-date/timezone *math* on data you already
have, which belongs in datemath, not here. This module only ever reports
the live clock.

## Files

- `datetimemodule.go` — module wiring (routes, HTTP handlers)
- `datetime.go` — pure logic (`Now`)
- `datetime_test.go` — format, timezone, and error tests
