# Temporal expressions

Dates, times, timestamps and intervals.

# TimeValue { #letsql.vendor.ibis.expr.types.temporal.TimeValue }

```python
TimeValue(self, arg)
```



## Methods

| Name | Description |
| --- | --- |
| [hour](#letsql.vendor.ibis.expr.types.temporal.TimeValue.hour) | Extract the hour component. |
| [microsecond](#letsql.vendor.ibis.expr.types.temporal.TimeValue.microsecond) | Extract the microsecond component. |
| [millisecond](#letsql.vendor.ibis.expr.types.temporal.TimeValue.millisecond) | Extract the millisecond component. |
| [minute](#letsql.vendor.ibis.expr.types.temporal.TimeValue.minute) | Extract the minute component. |
| [second](#letsql.vendor.ibis.expr.types.temporal.TimeValue.second) | Extract the second component. |
| [time](#letsql.vendor.ibis.expr.types.temporal.TimeValue.time) | Return the time component of the expression. |
| [truncate](#letsql.vendor.ibis.expr.types.temporal.TimeValue.truncate) | Truncate the expression to a time expression in units of `unit`. |

### hour { #letsql.vendor.ibis.expr.types.temporal.TimeValue.hour }

```python
hour()
```

Extract the hour component.

### microsecond { #letsql.vendor.ibis.expr.types.temporal.TimeValue.microsecond }

```python
microsecond()
```

Extract the microsecond component.

### millisecond { #letsql.vendor.ibis.expr.types.temporal.TimeValue.millisecond }

```python
millisecond()
```

Extract the millisecond component.

### minute { #letsql.vendor.ibis.expr.types.temporal.TimeValue.minute }

```python
minute()
```

Extract the minute component.

### second { #letsql.vendor.ibis.expr.types.temporal.TimeValue.second }

```python
second()
```

Extract the second component.

### time { #letsql.vendor.ibis.expr.types.temporal.TimeValue.time }

```python
time()
```

Return the time component of the expression.

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                            | Description                  |
|--------|-----------------------------------------------------------------|------------------------------|
|        | [TimeValue](`letsql.vendor.ibis.expr.types.temporal.TimeValue`) | The time component of `self` |

### truncate { #letsql.vendor.ibis.expr.types.temporal.TimeValue.truncate }

```python
truncate(unit)
```

Truncate the expression to a time expression in units of `unit`.

Commonly used for time series resampling.

#### Parameters {.doc-section .doc-section-parameters}

| Name   | Type                                                                       | Description             | Default    |
|--------|----------------------------------------------------------------------------|-------------------------|------------|
| unit   | [Literal](`typing.Literal`)\[\'h\', \'m\', \'s\', \'ms\', \'us\', \'ns\'\] | The unit to truncate to | _required_ |

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                            | Description                |
|--------|-----------------------------------------------------------------|----------------------------|
|        | [TimeValue](`letsql.vendor.ibis.expr.types.temporal.TimeValue`) | `self` truncated to `unit` |

# DateValue { #letsql.vendor.ibis.expr.types.temporal.DateValue }

```python
DateValue(self, arg)
```



## Methods

| Name | Description |
| --- | --- |
| [day](#letsql.vendor.ibis.expr.types.temporal.DateValue.day) | Extract the day component. |
| [day_of_year](#letsql.vendor.ibis.expr.types.temporal.DateValue.day_of_year) | Extract the day of the year component. |
| [epoch_seconds](#letsql.vendor.ibis.expr.types.temporal.DateValue.epoch_seconds) | Extract UNIX epoch in seconds. |
| [month](#letsql.vendor.ibis.expr.types.temporal.DateValue.month) | Extract the month component. |
| [quarter](#letsql.vendor.ibis.expr.types.temporal.DateValue.quarter) | Extract the quarter component. |
| [truncate](#letsql.vendor.ibis.expr.types.temporal.DateValue.truncate) | Truncate date expression to units of `unit`. |
| [week_of_year](#letsql.vendor.ibis.expr.types.temporal.DateValue.week_of_year) | Extract the week of the year component. |
| [year](#letsql.vendor.ibis.expr.types.temporal.DateValue.year) | Extract the year component. |

### day { #letsql.vendor.ibis.expr.types.temporal.DateValue.day }

```python
day()
```

Extract the day component.

### day_of_year { #letsql.vendor.ibis.expr.types.temporal.DateValue.day_of_year }

```python
day_of_year()
```

Extract the day of the year component.

### epoch_seconds { #letsql.vendor.ibis.expr.types.temporal.DateValue.epoch_seconds }

```python
epoch_seconds()
```

Extract UNIX epoch in seconds.

### month { #letsql.vendor.ibis.expr.types.temporal.DateValue.month }

```python
month()
```

Extract the month component.

### quarter { #letsql.vendor.ibis.expr.types.temporal.DateValue.quarter }

```python
quarter()
```

Extract the quarter component.

### truncate { #letsql.vendor.ibis.expr.types.temporal.DateValue.truncate }

```python
truncate(unit)
```

Truncate date expression to units of `unit`.

#### Parameters {.doc-section .doc-section-parameters}

| Name   | Type                                                             | Description               | Default    |
|--------|------------------------------------------------------------------|---------------------------|------------|
| unit   | [Literal](`typing.Literal`)\[\'Y\', \'Q\', \'M\', \'W\', \'D\'\] | Unit to truncate `arg` to | _required_ |

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                            | Description                     |
|--------|-----------------------------------------------------------------|---------------------------------|
|        | [DateValue](`letsql.vendor.ibis.expr.types.temporal.DateValue`) | Truncated date value expression |

### week_of_year { #letsql.vendor.ibis.expr.types.temporal.DateValue.week_of_year }

```python
week_of_year()
```

Extract the week of the year component.

### year { #letsql.vendor.ibis.expr.types.temporal.DateValue.year }

```python
year()
```

Extract the year component.

# DayOfWeek { #letsql.vendor.ibis.expr.types.temporal.DayOfWeek }

```python
DayOfWeek(self, expr)
```

A namespace of methods for extracting day of week information.

## Methods

| Name | Description |
| --- | --- |
| [full_name](#letsql.vendor.ibis.expr.types.temporal.DayOfWeek.full_name) | Get the name of the day of the week. |
| [index](#letsql.vendor.ibis.expr.types.temporal.DayOfWeek.index) | Get the index of the day of the week. |

### full_name { #letsql.vendor.ibis.expr.types.temporal.DayOfWeek.full_name }

```python
full_name()
```

Get the name of the day of the week.

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                               | Description                     |
|--------|--------------------------------------------------------------------|---------------------------------|
|        | [StringValue](`letsql.vendor.ibis.expr.types.strings.StringValue`) | The name of the day of the week |

### index { #letsql.vendor.ibis.expr.types.temporal.DayOfWeek.index }

```python
index()
```

Get the index of the day of the week.

::: {.callout-note}
## Ibis follows the `pandas` convention for day numbering: Monday = 0 and Sunday = 6.
:::

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                                 | Description                       |
|--------|----------------------------------------------------------------------|-----------------------------------|
|        | [IntegerValue](`letsql.vendor.ibis.expr.types.numeric.IntegerValue`) | The index of the day of the week. |

# TimestampValue { #letsql.vendor.ibis.expr.types.temporal.TimestampValue }

```python
TimestampValue(self, arg)
```



## Methods

| Name | Description |
| --- | --- |
| [date](#letsql.vendor.ibis.expr.types.temporal.TimestampValue.date) | Return the date component of the expression. |
| [truncate](#letsql.vendor.ibis.expr.types.temporal.TimestampValue.truncate) | Truncate timestamp expression to units of `unit`. |

### date { #letsql.vendor.ibis.expr.types.temporal.TimestampValue.date }

```python
date()
```

Return the date component of the expression.

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                            | Description                  |
|--------|-----------------------------------------------------------------|------------------------------|
|        | [DateValue](`letsql.vendor.ibis.expr.types.temporal.DateValue`) | The date component of `self` |

### truncate { #letsql.vendor.ibis.expr.types.temporal.TimestampValue.truncate }

```python
truncate(unit)
```

Truncate timestamp expression to units of `unit`.

#### Parameters {.doc-section .doc-section-parameters}

| Name   | Type                                                                                                          | Description         | Default    |
|--------|---------------------------------------------------------------------------------------------------------------|---------------------|------------|
| unit   | [Literal](`typing.Literal`)\[\'Y\', \'Q\', \'M\', \'W\', \'D\', \'h\', \'m\', \'s\', \'ms\', \'us\', \'ns\'\] | Unit to truncate to | _required_ |

#### Returns {.doc-section .doc-section-returns}

| Name   | Type                                                                      | Description                    |
|--------|---------------------------------------------------------------------------|--------------------------------|
|        | [TimestampValue](`letsql.vendor.ibis.expr.types.temporal.TimestampValue`) | Truncated timestamp expression |

# IntervalValue { #letsql.vendor.ibis.expr.types.temporal.IntervalValue }

```python
IntervalValue(self, arg)
```



## Methods

| Name | Description |
| --- | --- |
| [to_unit](#letsql.vendor.ibis.expr.types.temporal.IntervalValue.to_unit) |  |

### to_unit { #letsql.vendor.ibis.expr.types.temporal.IntervalValue.to_unit }

```python
to_unit(target_unit)
```

