> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# uuid_timestamp_micros()

> Extract a Postgres timestamp with microsecond precision from a version 7 UUID

export const PG = 'Postgres';

<Icon icon="tag" iconType="duotone" /> Since [2.23.0][tsdb-2.23.0]

Extract a [{PG} timestamp with time zone][pg-timestamp-timezone] from a UUIDv7 object.
`uuid` contains a millisecond unix timestamp and an optional sub-millisecond fraction.

Unlike [`uuid_timestamp`][uuid_timestamp], the microsecond part of `uuid` is used to construct a
{PG} timestamp with microsecond precision.

Unless `uuid` is known to encode a valid sub-millisecond fraction, use [`uuid_timestamp`][uuid_timestamp].

![UUIDv7 microseconds][uuidv7-microseconds]

## Samples

```sql theme={"dark"}
SELECT uuid_timestamp_micros('019913ce-f124-7835-96c7-a2df691caa98');
```

Returns something like:

```terminaloutput theme={"dark"}
uuid_timestamp_micros
-------------------------------
 2025-09-04 10:19:13.316512+02
```

## Arguments

The syntax is:

```sql theme={"dark"}
SELECT uuid_timestamp_micros(
    uuid = <uuid>
);
```

| Name   | Type | Default | Required | Description                                   |
| ------ | ---- | ------- | -------- | --------------------------------------------- |
| `uuid` | UUID | -       | ✔        | The UUID object to extract the timestamp from |

## Returns

| Column                  | Type        | Description                                                                |
| ----------------------- | ----------- | -------------------------------------------------------------------------- |
| `uuid_timestamp_micros` | TIMESTAMPTZ | The timestamp extracted from the UUIDv7 object with microsecond precision. |

[pg-timestamp-timezone]: https://www.postgresql.org/docs/current/datatype-datetime.html

[tsdb-2.23.0]: https://github.com/timescale/timescaledb/releases/tag/2.23.0

[uuid_timestamp]: /api-reference/timescaledb/uuid-functions/uuid_timestamp

[uuidv7-microseconds]: https://assets.timescale.com/docs/images/uuidv7-structure-microseconds.svg
