> ## 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.

# DAYOFWEEK

> Extracts the Sunday-based weekday number from a date or timestamp.

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

NULL input returns NULL.

## Syntax

### Scalar

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

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | DATE or TIMESTAMP | Yes | Value to inspect. |

## Returns

* Type: INTEGER
* Possible values: Sunday=1 through Saturday=7.
* NULL behavior: NULL input returns NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* Date and time components are returned as INTEGER.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT dayofweek(DATE '2024-03-15') AS "value";
```

| value |
| - |
| 6 |

### Sunday and Monday numbering

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT dayofweek(DATE '2024-03-17') AS sunday, dayofweek(DATE '2024-03-18') AS monday;
```

| sunday | monday |
| - | - |
| 1 | 2 |

## Related functions

* [date\_part](/query/sql/functions/date-time/date_part)


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