arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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.

hashtag
Signature

TIMECONVERT(col, fromUnit, toUnit)

The supported units are as follows:

  • DAYS

  • HOURS

  • MINUTES

hashtag
Usage Examples

These examples are based on the .

id
created_at_timestamp
timeInMs
convertedTime
id
created_at_timestamp
timeInMs
convertedTime
id
created_at_timestamp
timeInMs
convertedTime
id
created_at_timestamp
timeInMs
convertedTime
id
created_at_timestamp
timeInMs
convertedTime
id
created_at_timestamp
timeInMs
convertedTime
SECONDS
  • MILLISECONDS

  • MICROSECONDS

  • NANOSECONDS

  • 7044874109

    2018-01-01 11:00:00.0

    1514804400000

    17532

    7044874109

    2018-01-01 11:00:00.0

    1514804400000

    420779

    7044874109

    2018-01-01 11:00:00.0

    1514804400000

    1514804400

    7044874109

    2018-01-01 11:00:00.0

    1514804400000

    1514804400000

    7044874109

    2018-01-01 11:00:00.0

    1514804400000

    1514804400000000

    7044874109

    2018-01-01 11:00:00.0

    1514804400000

    1514804400000000000

    Batch JSON Quick Start
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'DAYS') AS convertedTime
    from githubEvents
    LIMIT 1
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'HOURS') AS convertedTime
    from githubEvents
    LIMIT 1
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'SECONDS') AS convertedTime
    from githubEvents
    LIMIT 1
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'MILLISECONDS') AS convertedTime
    from githubEvents
    LIMIT 1
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'MICROSECONDS') AS convertedTime
    from githubEvents
    LIMIT 1
    select id, 
           created_at_timestamp, 
           cast(created_at_timestamp AS long) AS timeInMs,
           TIMECONVERT(created_at_timestamp, 'MILLISECONDS', 'NANOSECONDS') AS convertedTime
    from githubEvents
    LIMIT 1