Skip to content

12-Hour Time (HH:MM AM/PM)

Type Registry

12-Hour Time (HH:MM AM/PM)

datetime.time.hm_12h

Hours and minutes with AM/PM, no seconds. Common in US scheduling applications and user interfaces.

Domain datetimetime
Casts to TIME
Scope Universal

Try it

CLI
$ finetype infer -i "10:30 AM"
→ datetime.time.hm_12h

DuckDB

Detect
SELECT finetype('10:30 AM');
-- → 'datetime.time.hm_12h'
Cast expression
strptime({col}, '%I:%M %p')::TIME
Format: %I:%M %p
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS TIME) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'datetime.time.hm_12h';

JSON Schema

finetype schema datetime.time.hm_12h
{
  "$id": "https://noon.sh/schemas/datetime.time.hm_12h",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Hours and minutes with AM/PM, no seconds. Common in US scheduling applications and user interfaces.",
  "examples": [
    "10: 30 AM",
    "11: 59 PM"
  ],
  "maxLength": 8,
  "minLength": 8,
  "pattern": "^\\d{2}:\\d{2} [AP]M$",
  "title": "12-Hour Time (HH:MM AM/PM)",
  "type": "string"
}

Examples

10:30 AM11:59 PM

Types in datetime