Returns the duration representation of 1 millisecond, or the milliseconds corresponding to a given timestamp. Optionally, you can add a timezone different than your current one.
How does it work in the search window?
Select Create column in the search window toolbar, then select the Millisecond operation.
This operation can be applied with no arguments. In this case, you will get the duration representation of 1 millisecond (duration data type, 1).
Note that millisecond durations are represented only as integer numbers, with no symbol representation.
If you add the Timestamp argument, you will get the milliseconds considering your current timezone. Optionally, you can specify a different time zone adding the Time zone argument. In both cases, the data type of the new column values will be integer (values 0-999).
Note that the count starts at 0, so the result will be the number of milliseconds - 1 (for example, if the millisecond amount is 528, you will get 527).
demo.ecommerce.data table, we want to create a column showing the milliseconds of the dates in our eventdate column. To do it, we will create a new column using the Millisecond operation.
The arguments needed to create the new column are:
- Timestamp - eventdate column
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 for the Millisecond operation:
millisecond()→ Use this expression to get the representation of one millisecond in duration data type (1).
millisecond(timestamp)→ Use this expression to get the milliseconds corresponding to the given timestamps, according to your current time zone.
millisecond(timestamp, timezone_string)→ Use this expression to get the milliseconds corresponding to the given timestamps, according to the specified time zone.
You can copy the following LINQ script and try the above example on the
from demo.ecommerce.data select millisecond(eventdate) as eventdates_milliseconds