autoEpochToTime
autoEpochToTime
converts an offset value from Unix Epoch to a date-time. This method uses expected date ranges to infer whether the passed value is in milliseconds, microseconds, or nanoseconds.
Syntax
autoEpochToTime(offset)
Parameters
Parameter | Type | Description |
---|---|---|
offset | long | The offset value to convert to a date-time. This method uses expected date ranges to infer whether the passed value is in milliseconds, microseconds, or nanoseconds. Thresholds used are
The value is tested to see if its ABS exceeds the threshold; e.g., a value whose ABS is greater than |
Returns
The offset since the Unix Epoch in the UTC time zone converted to a date-time.
note
Null input values will return NULL_LONG
.
Examples
The following example demonstrates how Deephaven infers the passed value. All three return the same result.
println autoEpochToTime(150000000) // milliseconds
println autoEpochToTime(150000000000) // microseconds
println autoEpochToTime(150000000000000) // nanoseconds
- Log
In the following example, a new column (Time
) is added that converts the specified offset value into a date-time.
source = newTable(
stringCol("Ticker", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL"),
dateTimeCol("Timestamp", convertDateTime("2021-04-05T09:10:39.123456700 NY"), convertDateTime("2021-04-05T09:10:50.123456700 NY"), convertDateTime("2021-04-05T09:11:39.123456700 NY"), convertDateTime("2021-04-05T09:11:50.123456700 NY"), convertDateTime("2021-04-05T09:12:39.123456700 NY")),
doubleCol("Price", 100.10, 101.0, 102.40, 100.50, 100.30),
intCol("Size", 52, 14, 73, 11, 6)
)
result = source.update("Time = autoEpochToTime(5000)")
- source
- result