Gets the millisecond of a timestamp field.

ParameterTypeRequiredDefault ValueDescription
asstringoptional[a] _millisecond The name of the output field.
field[b]stringoptional[a] @timestamp The name of the input field.
timezonestringoptional[a]   The time offset to use, for example, -01:00. If not specified, the query's offset will be used.
timezoneFieldstringoptional[a] @timezone The name of the field containing the timezone to use, if not specified the query's timezone will be used. This is ignored if the timezone parameter is passed as well. If this is not defined the timezone offset of the query will be used.

[a] Optional parameters use their default value unless explicitly set.

[b] The parameter name field can be omitted.

Hide omitted argument names for this function

Show omitted argument names for this function

Click + next to an example below to get the full details.

Extract Millisecond From Timestamp

Get the millisecond from a timestamp using the time:millisecond() function

Query
logscale
time:millisecond(timestamp, as=ms)
Introduction

In this example, the time:millisecond() function is used to extract the milliseconds from a specific timestamp 2025-08-27 08:51:51.312, demonstrating how to get the millisecond value from a datetime.

Step-by-Step
  1. Starting with the source repository events.

  2. logscale
    time:millisecond(timestamp, as=ms)

    Extracts the milliseconds from the @timestamp field and returns the result in a new field named ms. If the as parameter is not specified, the result is returned in a field named _millisecond as default.

  3. Event Result set.

Summary and Results

The query is used to extract the milliseconds from a timestamp, which is useful for analyzing events at a sub-second level of precision.

This query is useful, for example, to analyze high-precision timing, measure small time differences, or investigate event sequencing at millisecond resolution.

Sample output from the incoming example data:

@timestampms
2025-08-27 08:51:51.312312

The result shows how the time:millisecond() function extracts the milliseconds (in this case 312) from the timestamp, indicating there are 312 milliseconds in this timestamp.

For visualizing this data, consider using a Scatter Plot widget to show event distribution within seconds, or a Line Chart widget to display high-precision timing patterns. The time:millisecond() function is often used with other time functions like time:second() and time:minute() for precise time analysis.