---
title: weekofyear function
description: Learn the syntax of the weekofyear function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/weekofyear
---

# `weekofyear` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the week of the year of `expr`.

## Syntax

```
weekofyear(expr)
```

## Arguments

* `expr`: A DATE expression.

## Returns

An INTEGER.

A week is considered to start on a Monday and week 1 is the first week with >3 days.
This function is a synonym for `extract(WEEK FROM expr)`.

## Examples

```sql
> SELECT weekofyear('2008-02-20');
 8
```

## Related functions

* [`day` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/day.md)
* [`dayofmonth` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofmonth.md)
* [`dayofyear` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofyear.md)
* [`extract` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/extract.md)
* [`dayofweek` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofweek.md)
