Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Ftime%2Ffromunixtime.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Ftime%2Ffromunixtime.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `fromUnixTime`

## Description

Returns a parsed timestamp from a numeric Unix time value.

The Unix epoch starts on January 1, 1970. Timestamps before this are represented by negative numbers.

## Syntax

Like many functions in DataPrime, `fromUnixTime` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
fromUnixTime(unixTime: number, timeUnit?: timeunit): timestamp
```

```
(unixTime: number).fromUnixTime(timeUnit?: timeunit): timestamp
```

## Arguments

| Name       | Type       | Required  | Description                                         |
| ---------- | ---------- | --------- | --------------------------------------------------- |
| `unixTime` | `number`   | **true**  | The Unix timestamp to convert                       |
| `timeUnit` | `timeunit` | **false** | The unit of the Unix timestamp. Defaults to `milli` |

## Example

**Use case: Convert a numeric Unix timestamp to a proper timestamp**

Interpret a numeric value as milliseconds since the epoch and convert it into a `timestamp`.

### Example query

* Function notation
* Method notation

```
choose fromUnixTime(1658958157515, 'ms') as ts
```

```
choose 1658958157515.fromUnixTime('ms') as ts
```

### Example output

```
{

  "ts": 1658958157515000000

}
```
