# unix_millis

> 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_millis
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-millis
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-millis.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/timestamp-functions/unix-millis.adoc
description: The `unix_millis()` function returns a given timestamp to a UNIX timestamp in milliseconds 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-millis.md -->

The `unix_millis()` function returns a given timestamp to a UNIX timestamp in milliseconds from 1970-01-01 00:00:00-00 (can be negative). Its syntax is:

```sql
SELECT UNIX_MILLIS(TIMESTAMP)
```

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

## [](#examples)Examples

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

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

```sql
SELECT UNIX_MILLIS(TIMESTAMP "1996-5-02 7:15:00+00") AS unix_millisvalues;
```

The query returns:

```sql
+-----------------------------+
| unix_millisvalues           |
+-----------------------------+
| 831021300000.000000         |
+-----------------------------+
```

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

Suppose a table named **time\_example** has these timestamp values in the **time\_stamp** column:

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

INSERT INTO time_example VALUES
('2004-07-23 11:30:00+00'),
('2011-02-12 04:45:00+00'),
('1975-08-03 07:50:00+00');
```

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

This query shows the table:

```sql
+-------------------------+
| time_example            |
+-------------------------+
| 2004-07-23 11:30:00     |
| 2011-02-12 04:45:00     |
| 1975-08-03 07:50:00     |
+-------------------------+
```

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

```sql
SELECT time_stamp, UNIX_MILLIS(time_stamp) AS time_millis FROM time_example;
```

The output displays all the timestamp entries of the table in the **time\_stamp** column and the converted UNIX milliseconds timestamp entries in the column **time\_millis**.

```sql
+-------------------------+-----------------------+
| time_stamp              | time_millis           |
+-------------------------+-----------------------+
| 2004-07-23 11:30:00     | 1090582200000.000000  |
| 2011-02-12 04:45:00     | 1297485900000.000000  |
| 1975-08-03 07:50:00     | 176284200000.000000   |
+-------------------------+-----------------------+
```