# unix_seconds

> 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_seconds
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-seconds
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-seconds.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/timestamp-functions/unix-seconds.adoc
description: The `unix_seconds()` function returns a given timestamp to a UNIX timestamp in seconds, from 1970-01-01 00:00:00-00.
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-seconds.md -->

The `unix_seconds()` function returns a given timestamp to a UNIX timestamp in seconds, from 1970-01-01 00:00:00-00. Its syntax is:

```sql
SELECT UNIX_SECONDS(TIMESTAMP)
```

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

## [](#examples)Examples

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

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

```sql
SELECT UNIX_SECONDS(TIMESTAMP "2008-12-25 15:30:00+00") AS unix_secondsvalues;
```

The query returns:

```sql
+-----------------------------+
| unix_secondsvalues          |
+-----------------------------+
| 1230219000.000000           |
+-----------------------------+
```

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

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

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

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

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

The query returns the table:

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

1.  To convert all timestamp values into UNIX timestamp values in seconds, run the query:

    ```sql
    SELECT time_stampvalues, UNIX_SECONDS(time_stampvalues)
    AS time_secondsvalues
    FROM time_example;
    ```

2.  The output displays all the timestamp entries of the table in the **time\_stampvalues** column and the converted UNIX seconds timestamp entries in the column **time\_secondsvalues**.

    ```sql
    +-------------------------+-----------------------+
    | time_stampvalues        | time_secondsvalues    |
    +-------------------------+-----------------------+
    | 2022-12-25 13:30:00     | 1671975000.000000     |
    | 2020-09-25 07:25:00     | 1601018700.000000     |
    | 2008-12-25 15:30:00     | 1230219000.000000     |
    | 2021-10-02 06:30:00     | 1633156200.000000     |
    +-------------------------+-----------------------+
    ```