---
title: timestamp_seconds
description: "timestamp\\_seconds function in PySpark: Converts the number of seconds from the Unix epoch (1970-01-01T00:00:00Z) to a timestamp."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/timestamp_seconds
---

# timestamp\_seconds

Converts the number of seconds from the Unix epoch (1970-01-01T00:00:00Z) to a timestamp.

For the corresponding Databricks SQL function, see [`timestamp_seconds` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/timestamp_seconds.md).

## Syntax

```python
from pyspark.sql import functions as dbf

dbf.timestamp_seconds(col=<col>)
```

## Parameters

| Parameter | Type                          | Description       |
| --------- | ----------------------------- | ----------------- |
| `col`     | `pyspark.sql.Column` or `str` | unix time values. |

## Returns

`pyspark.sql.Column`: converted timestamp value.

## Examples

```python
spark.conf.set("spark.sql.session.timeZone", "UTC")
```

```python
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(1230219000,), (1280219000,)], ['seconds'])
df.select('*', dbf.timestamp_seconds('seconds')).show()
spark.conf.unset("spark.sql.session.timeZone")
```
