> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WEEKOFYEAR

> Extracts the ISO 8601 week number component.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for NULL input. Some date/time components also return NULL when the input is outside their supported calendar range.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
weekofyear(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | DATE or TIMESTAMP | Yes | Temporal value whose component is extracted. |

## Returns

* Type: INTEGER
* Possible values: 1 through 53
* NULL behavior: Returns NULL for NULL input. Some date/time components also return NULL when the input is outside their supported calendar range.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Exact result | Yes |

## Usage notes

* Returns an INTEGER component, or NULL for a NULL input.
* ISO weeks begin Monday; week 1 contains January 4. Week numbers can belong to the neighboring ISO week-year.

## Examples

### Extract a component

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT weekofyear(DATE '2008-02-20') AS result;
```

| result |
| - |
| 8 |

### NULL input

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT weekofyear(CAST(NULL AS TIMESTAMP)) AS result;
```

| result |
| - |
| NULL |

## Limitations

* String inputs require conversion to a date or timestamp. Use the formats shown here; the example does not cover every date or time format.
* Inputs outside the supported calendar range can return NULL. YEAR and MONTH support a wider range than other fields.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.