# clock/scan
Parse a string into epoch seconds. Strict strptime-style dual of
`clock/format` — the same specifier table drives both. Free-form parsing is
intentionally not supported (TCL deprecated it for irreducible ambiguity):
`:format` is required.
## Syntax
[clock/scan $str %{ :format "…" :timezone "…" :base $time }] [clock/scan "2024-01-15" %{ :format "%Y-%m-%d" }] [clock/scan "2024-01-15 14:30:00" %{ :format "%Y-%m-%d %H:%M:%S" :timezone "UTC" }] [clock/scan "15/01/24" %{ :format "%d/%m/%y" :base $sometime }]
## Parameters
- `$str` — input string to parse
- spec-map keys:
- `:format` — format string (required), using the same specifiers as
clock/format
- `:timezone` — `"UTC"`, `"local"`, or `+HHMM` offset (default: local).
A `%z` in the input overrides this.
- `:base` — epoch seconds used as fallback for missing fields (default: now)
- `:locale` — locale name (English-only MVP — `""`, `"en"`, `"en_US"`)
## Field resolution
When the input doesn't specify every field:
- Year: from `%Y`, or `%C` + `%y`, or `%y` windowed (1938–2037), or from `:base`.
- Month/day: from `%m` + `%d`, or `%j` (day-of-year), or from `:base`.
- Time of day: from the input, or midnight — NOT the base's
time-of-day, per TCL.
- Timezone: `%z` in the input overrides `:timezone`.
## Examples
def t [clock/scan "2024-01-15 14:30:00" %{ :format "%Y-%m-%d %H:%M:%S" :timezone "UTC" }] [clock/format $t "%A, %B %d %Y" "UTC"] # → "Monday, January 15 2024"
## Returns
Epoch seconds (number), or `%Err{:message}` on a malformed input.
## See Also
`clock/format`, `clock/add`, `clock/seconds`