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

# NEXT_DAY

> Returns the next matching weekday strictly after the input date.

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

NULL input yields NULL. Invalid weekday/date text yields NULL.

## Syntax

### Scalar

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

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | Input temporal value. ISO yyyy-MM-dd date text stored as ordinary STRING; Pass STRING; DATE and TIMESTAMP inputs are outside this form. |
| weekday | STRING | Yes | Weekday name/abbreviation. ASCII English weekday names or abbreviations beginning SU, MO, TU, WE, TH, FR or SA; case-insensitive and trimmed. |

## Returns

* Type: DATE
* NULL behavior: NULL input yields NULL. Invalid weekday/date text yields NULL.

## Properties

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

## Usage notes

* Trimmed, case-insensitive first two letters identify the weekday. Matching the current weekday advances seven days.

## Examples

### Basic example

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT next_day('2015-01-14','TU') AS result;
```

| result |
| - |
| 2015-01-20 |

### The same weekday means the following week

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT next_day('2024-03-18', 'MON') AS next_monday;
```

| next\_monday |
| - |
| 2024-03-25 |

## Limitations

* Some STRING column representations currently raise a type error. The NULL and invalid-text rules above apply to the supported STRING representation.
* Use ASCII weekday names. Non-ASCII names can fail and are outside the supported inputs.


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