Meridianmeridian

SQL Timestamp with Microseconds and Offset

datetime.timestamp.sql_microseconds_offset

PostgreSQL TIMESTAMPTZ output format. Space-separated date and time with 6-digit microseconds and full timezone offset.

Domain
datetime
Category
timestamp
Casts to
TIMESTAMPTZ
Scope
Universal

Try it

CLI
$ finetype infer -i "2024-01-15 14:30:00.123456+00:00"
→ datetime.timestamp.sql_microseconds_offset

DuckDB

Detect
SELECT finetype('2024-01-15 14:30:00.123456+00:00');
-- → 'datetime.timestamp.sql_microseconds_offset'
Cast expression
strptime({col}, '%Y-%m-%d %H:%M:%S.%f%z')
-- Format: %Y-%m-%d %H:%M:%S.%f%z
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS TIMESTAMPTZ) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'datetime.timestamp.sql_microseconds_offset';

JSON Schema

finetype schema datetime.timestamp.sql_microseconds_offset
{
  "$id": "https://meridian.online/schemas/datetime.timestamp.sql_microseconds_offset",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "PostgreSQL TIMESTAMPTZ output format. Space-separated date and time with 6-digit microseconds and full timezone offset.",
  "examples": [
    "2024-01-15 14: 30: 00.123456+00: 00",
    "2023-12-31 23: 59: 59.000000-05: 00",
    "2024-06-01 08: 15: 30.789012+05: 30"
  ],
  "maxLength": 32,
  "minLength": 32,
  "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{6}[+-]\\d{2}:\\d{2}$",
  "title": "SQL Timestamp with Microseconds and Offset",
  "type": "string",
  "x-finetype-broad-type": "VARCHAR",
  "x-finetype-format-string": "%Y-%m-%d %H:%M:%S.%f%z",
  "x-finetype-transform": "strptime({col}, '%Y-%m-%d %H:%M:%S.%f%z')"
}

Examples

2024-01-15 14:30:00.123456+00:002023-12-31 23:59:59.000000-05:002024-06-01 08:15:30.789012+05:30

Aliases

pg_timestamptz