---
title: toTime() function
description: toTime() converts all values in the _value column to time types.
url: https://docs.influxdata.com/flux/v0/stdlib/universe/totime/
estimated_tokens: 1302
product: Flux
version: v0
---

# toTime() function

-   Flux 0.7.0+
-   View InfluxDB support

`toTime()` converts all values in the `_value` column to time types.

#### Supported data types

-   string (RFC3339 timestamp)
-   int
-   uint

`toTime()` treats all numeric input values as nanosecond epoch timestamps.

##### Function type signature

```js
(<-tables: stream[{A with _value: B}]) => stream[{A with _value: B, _value: time}]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### tables

Input data. Default is piped-forward data (`<-`).

## Examples

### Convert an integer \_value column to times

```js
data
    |> toTime()
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -20000000000000000 | t1 |
| 2021-01-01T00:00:10Z | 100000000000000000 | t1 |
| 2021-01-01T00:00:20Z | 70000000000000000 | t1 |
| 2021-01-01T00:00:30Z | 170000000000000000 | t1 |
| 2021-01-01T00:00:40Z | 150000000000000000 | t1 |
| 2021-01-01T00:00:50Z | 40000000000000000 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | 190000000000000000 | t2 |
| 2021-01-01T00:00:10Z | 40000000000000000 | t2 |
| 2021-01-01T00:00:20Z | -30000000000000000 | t2 |
| 2021-01-01T00:00:30Z | 190000000000000000 | t2 |
| 2021-01-01T00:00:40Z | 130000000000000000 | t2 |
| 2021-01-01T00:00:50Z | 10000000000000000 | t2 |

#### Output data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | 1969-05-14T12:26:40Z | t1 |
| 2021-01-01T00:00:10Z | 1973-03-03T09:46:40Z | t1 |
| 2021-01-01T00:00:20Z | 1972-03-21T04:26:40Z | t1 |
| 2021-01-01T00:00:30Z | 1975-05-22T14:13:20Z | t1 |
| 2021-01-01T00:00:40Z | 1974-10-03T02:40:00Z | t1 |
| 2021-01-01T00:00:50Z | 1971-04-08T23:06:40Z | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | 1976-01-09T01:46:40Z | t2 |
| 2021-01-01T00:00:10Z | 1971-04-08T23:06:40Z | t2 |
| 2021-01-01T00:00:20Z | 1969-01-18T18:40:00Z | t2 |
| 2021-01-01T00:00:30Z | 1976-01-09T01:46:40Z | t2 |
| 2021-01-01T00:00:40Z | 1974-02-13T15:06:40Z | t2 |
| 2021-01-01T00:00:50Z | 1970-04-26T17:46:40Z | t2 |

#### Related

-   [Work with time types](/flux/v0/data-types/basic/time/)
-   [time() function](/flux/v0/stdlib/universe/time/)

[transformations](/flux/v0/tags/transformations/) [type-conversions](/flux/v0/tags/type-conversions/)
