# `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://coralogix.com/docs/dataprime/language-reference/functions-reference/index.md), **function** and **method** notation. These interchangeable forms allow flexibility in how you structure expressions.

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

```dataprime
(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

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

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

### Example output

```json
{
  "ts": 1658958157515000000
}
```
