Epoch milliseconds (epoch)
Description
Creates a new column that converts a specified timestamp into an Epoch reference date, that is to say, the number of milliseconds since midnight Jan 1, 1970.
How does it work in the search window?
Select Create column in the search window toolbar, then select the Epoch milliseconds operation. You need to specify one argument:
Argument | Data type | Description |
---|---|---|
Date mandatory | timestamp | You can either select a column with that data type or introduce it manually. In case you want to introduce it, note that this value should be a date: Year-Month_Day Hour:Minute:Second.Millisecond (yyyy-MM-dd HH:mm:ss.SSS) → You can skip seconds and milliseconds. |
The data type of the values in the new column is integer.
When you apply this operation in the search window interface, Devo automatically transforms the values you enter manually in the Date argument into timestamp data type.
If you choose a column in the Date argument, it must be a timestamp data type column. You can transform the strings or integers in a field to timestamps creating a new column using the Timestamp operation. Note that the strings to be converted must follow the format yyyy-MM-dd HH:mm:ss.SSS
Example
In the demo.ecommerce.data
table, we want to create a column that transforms the dates in our eventdate column into Epoch milliseconds. To do it, we will create a new column using the Epoch milliseconds operation.
The arguments needed to create the new column are:
Date - eventdate column
Click Create column and you will see the following result:
How does it work in LINQ?
Use the operator select
... as
... and add the operation syntax to create the new column. These are the valid formats for the Epoch milliseconds operation:
epoch(timestamp)
epoch(timestamp(string))
epoch(timestamp(integer))
When you use this operation in LINQ, you can indicate the name of a timestamp type column or use the Timestamp operation to transform a string / integer column or an entered value into timestamp format. To do it, add the timestamp()
 operator as in the above format examples.
Note that the strings to be converted must follow the format yyyy-MM-dd HH:mm:ss.SSS
Example
You can copy the following LINQ script and try the above example on the demo.ecommerce.data
table:
from demo.ecommerce.data
select epoch(eventdate) as eventdate_epoch