# unix_micros

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: unix_micros
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/timestamp-functions/unix-micros
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/timestamp-functions/unix-micros.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/timestamp-functions/unix-micros.adoc
description: The `unix_micros()` function returns a given timestamp into a UNIX timestamp in microseconds, from 1970-01-01 00:00:00-00 (can be negative).
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/timestamp-functions/unix-micros.md -->

The `unix_micros()` function returns a given timestamp into a UNIX timestamp in microseconds, from 1970-01-01 00:00:00-00 (can be negative):

```sql
SELECT UNIX_MICROS(TIMESTAMP)
```

Its input type is a `timestamp` expression, and the return data type is `int64` representing time in microseconds.

## [](#examples)Examples

### [](#basic-unix_micros-function)Basic `unix_micros()` function

This example shows how to use the `unix_micros()` function to convert a given timestamp into a UNIX timestamp in microseconds:

```sql
SELECT UNIX_MICROS(TIMESTAMP "2022-12-25 13:30:00+00") AS unix_microsvalues;
```

The query returns:

```sql
+-----------------------------+
| unix_microsvalues           |
+-----------------------------+
| 1671975000000000.000000     |
+-----------------------------+
```

### [](#unix_micros-function-using-columns)`unix_micros()` function using columns

Suppose a table named **time\_example** has these timestamp values:

```sql
CREATE TABLE time_example (
  time_stamp timestamp
);

INSERT INTO time_example VALUES
('2022-12-25 13:30:00'),
('2021-10-02 06:30:00'),
('2020-09-25 07:25:00');
```

```sql
SELECT * FROM time_example;
```

This query shows the table:

```sql
+-------------------------+
| time_example            |
+-------------------------+
| 2022-12-25 13:30:00     |
| 2021-10-02 06:30:00     |
| 2020-09-25 07:25:00     |
+-------------------------+
```

To convert all timestamp values into UNIX timestamp values in microseconds, run the query:

```sql
SELECT time_stamp, UNIX_MICROS(time_stamp)
AS time_micros
FROM time_example;
```

The output displays all the timestamp entries in the **time\_stamp** column and the converted UNIX timestamps in microseconds in the column **time\_micros**.

```sql
+-------------------------+--------------------------+
| time_stamp               | time_micros              |
+-------------------------+--------------------------+
| 2022-12-25 13:30:00     | 1671975000000000.000000  |
| 2021-10-02 06:30:00     | 1633156200000000.000000  |
| 2020-09-25 07:25:00     | 1601018700000000.000000  |
+-------------------------+--------------------------+
```