# timerender

## Overview

The `timerender` statement is used to create or update a column containing human-readable versions of UNIX timestamps

## Syntax

**`timerender`***`timestampCol`***`as`***`readableCol`*

## Details

When working with time-sensitive data, Exivity uses UNIX epoch timestamps (accurate to 1 second) which contain an integer representing the number of seconds that have elapsed since 00:00:00 on January 1st 1970.

These values can be generated from usage data using the [timestamp](https://olddocs.exivity.io/3.5.4/data-pipelines/transform/language/timestamp) statement and may be modified during aggregation, so in order to assist the development and debugging of Transcript tasks the `timerender` statement may be used to create human-readable versions UNIX timestamps as follows:

* The *timestampCol* parameter is the name of the column containing the UNIX timestamps to convert
* The *readableCol* parameter is the name fo the column to write the human-readable strings into

If the *readableCol* column does not exist, it will be created. If it does exist then the values in it will be updated.

{% hint style="info" %}
If *readableCol* exists and the 'overwrite' option is disabled via [option overwrite](https://olddocs.exivity.io/3.5.4/data-pipelines/transform/language/option) then only blank values will be updated
{% endhint %}

The human readable timestamps contain fields for *year month day hour minute second*, eg: `20170518 17:00:00`.

{% hint style="warning" %}
The `timerender` statement will always use the local timezone of the Exivity server when converting the timestamps. If other timezones are required then [timestamp](https://olddocs.exivity.io/3.5.4/data-pipelines/transform/language/timestamp) can be invoked with the `offset` option to adjust the UNIX timestamps as required
{% endhint %}

If any values in *timestampCol* are blank, or do not contain a valid UNIX timestamp then the value in *readableCol* on the same row will default to a blank value.

## Example

```
# Import raw usage data
import "system\extracted\csp_usage.csv" source CSP alias usage

# Create UNIX start and end time columns from it
var template = YYYY.MM.DD.hh.mm.ss
timestamp START_TIME_UNIX using usageStartTime template ${template}
timestamp END_TIME_UNIX using usageEndTime template ${template}

# Render human-readable columns
timerender START_TIME_UNIX as START_TIME_HUMAN
timerender END_TIME_UNIX as END_TIME_HUMAN
```
