Apache Pinot Docs
Search…
latest
Configuration Reference
TIMECONVERT
This section contains reference documentation for the TIMECONVERT function.
Converts the value from a column that contains an epoch timestamp into another time unit. The converted value will be rounded down.

Signature

TIMECONVERT(col, fromUnit, toUnit)
The supported units are as follows:
  • DAYS
  • HOURS
  • MINUTES
  • SECONDS
  • MILLISECONDS
  • MICROSECONDS
  • NANOSECONDS

Usage Examples

These examples are based on the Batch JSON Quick Start.
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'DAYS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
17532
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'HOURS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
420779
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'SECONDS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
1514804400
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'MILLISECONDS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
1514804400000
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'MICROSECONDS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
1514804400000000
1
select id,
2
created_at_timestamp,
3
cast(created_at_timestamp AS long) AS timeInMs,
4
TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'NANOSECONDS') AS convertedTime
5
from githubEvents
6
LIMIT 1
Copied!
id
created_at_timestamp
timeInMs
convertedTime
7044874109
2018-01-01 11:00:00.0
1514804400000
1514804400000000000
Last modified 6mo ago
Copy link