This operation performs two types of conversions:
- Converts an epoch date (integer) to a readable timestamp. The epoch date must be expressed in milliseconds (13 digits).
- Converts a correctly formatted date string to a timestamp. See the description below for the correct format.
How does it work in the search window?
Select Create column in the search window toolbar, then select the Timestamp operation. It only requires one argument, either an integer or a string column.
|Epoch / Date definition (mandatory)||integer or string|
To convert an epoch date integer to a timestamp, it must be expressed in milliseconds (13 digits). If it is expressed in seconds (10 digits), it will return the initial epoch date of Jan 1, 1970.
If your epoch date has just 10 digits, you can add zeros to the end of it using the following LINQ:
Once the epoch date is expressed in milliseconds, you can apply the
To convert a date field from string to timestamp, the date must follow the format: Year-Month-Day Hour:Minute:Second.Millisecond (i.e. 2019-09-09 09:52:49.986). If your date string doesn't follow the required format, you should instead use the parsedate operation to convert it to a timestamp.
The data type of the values in the new column is timestamp.
Let's use the operation to convert an epoch date to the corresponding timestamp. With the my.lookuplist.conversion table open in the search window, we click Create column and select the Timestamp operation. Select the epochMsInt column as the argument and assign a name to the new column - let's call it epochTimestamp.
Click Create column and you will see the following result:
How does it work in LINQ?
Use the operator
as... and add the operation syntax to create the new column. These are the valid formats of the operation:
Copy the following LINQ script and use it to replicate the previous example.