Gets the day of the year of a timestamp field (from 1 to 365, or 366 in a leap year).

ParameterTypeRequiredDefault ValueDescription
asstringoptional[a] _dayOfYear 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 Day of Year From Timestamp

Get the day of year from a timestamp using the time:dayOfYear() function

Query
logscale
time:dayOfYear(timestamp, as=yearday)
Introduction

In this example, the time:dayOfYear() function is used to extract the day from a specific timestamp 2025-08-27 08:51:51.000, demonstrating how to get the day of year value from a datetime.

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

  2. logscale
    time:dayOfYear(timestamp, as=yearday)

    Extracts the day of the year from the @timestamp field and returns the result in a new field named yearday. If the as parameter is not specified, the result is returned in a field named _dayOfYear as default.

  3. Event Result set.

Summary and Results

The query is used to extract the day of the year from a timestamp, which is useful for analyzing event patterns across the entire year.

This query is useful, for example, to analyze annual patterns, track yearly progress, or identify seasonal trends.

Sample output from the incoming example data:

@timestampyearday
2025-08-27 08:51:51.000239

The result shows how the time:dayOfYear() function extracts the day of the year (in this case 239) from the timestamp, indicating it is the 239th day of 2025.

For visualizing this data, consider using a Line Chart widget to show event patterns across the year, or a Heat Map widget to display activity patterns throughout the year. The time:dayOfYear() function is often used with other time functions like time:month() and time:year() for complete date analysis.