This page explains how to use the week_of_year function in APL.
week_of_year
function in APL to extract the ISO 8601 week number from a datetime expression. The ISO 8601 standard defines the first week of the year as the one that contains the first Thursday of the year, and weeks start on Mondays.
You can use week_of_year
to group records by week when analyzing trends over time. This is especially useful for weekly aggregation in dashboards, anomaly detection, and cohort analysis.
Use it when you want to:
Splunk SPL users
strftime
function with the %V
or %U
specifiers to extract the week of the year. In APL, the week_of_year
function directly extracts the ISO 8601 week number from a datetime.ANSI SQL users
EXTRACT(WEEK FROM timestamp)
or DATEPART(WEEK, timestamp)
. These implementations may differ slightly across platforms in how they define the first week of the year. APL uses the ISO 8601 definition via week_of_year
.Name | Type | Description |
---|---|---|
datetime | datetime | The input datetime value. |
long
representing the ISO 8601 week number (from 1 to 53).
week | avg_req_duration_ms |
---|---|
1 | 243.8 |
2 | 251.1 |
3 | 237.4 |