Functions for working with dates and times

Returns year and week number as a combined integer value. [`UInt32`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Get year-week combinations with different modes**

```
SELECT toDate('2016-12-27') AS date, toYearWeek(date) AS yearWeek0, toYearWeek(date,1) AS yearWeek1, toYearWeek(date,9) AS yearWeek9, toYearWeek(toDate('2022-01-01')) AS prev_yearWeek
```

```
┌───────date─┬─yearWeek0─┬─yearWeek1─┬─yearWeek9─┬─prev_yearWeek─┐
│ 2016-12-27 │    201652 │    201652 │    201701 │        202152 │
└────────────┴───────────┴───────────┴───────────┴───────────────┘
```

## today[​](#today "Direct link to today")

Introduced in: v1.1.0

Returns the current date at moment of query analysis. Same as `toDate(now())`.

**Syntax**

```
today()
```

**Aliases**: `curdate`, `current_date`

**Arguments**

- None.

**Returned value**

Returns the current date [`Date`](/docs/sql-reference/data-types/date)

**Examples**

**Usage example**

```
SELECT today() AS today, curdate() AS curdate, current_date() AS current_date FORMAT Pretty
```

```
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃      today ┃    curdate ┃ current_date ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ 2025-03-03 │ 2025-03-03 │   2025-03-03 │
└────────────┴────────────┴──────────────┘
```

**SQL standard syntax without parentheses**

```
SELECT TODAY, CURDATE,CURRENT_DATE
```

```
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃      TODAY ┃    CURDATE ┃ CURRENT_DATE ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ 2025-03-04 │ 2025-03-04 │   2025-03-04 │
└────────────┴────────────┴──────────────┘
```

## yesterday[​](#yesterday "Direct link to yesterday")

Introduced in: v1.1.0

Accepts zero arguments and returns yesterday's date at one of the moments of query analysis.

**Syntax**

```
yesterday()
```

**Arguments**

- None.

**Returned value**

Returns yesterday's date. [`Date`](/docs/sql-reference/data-types/date)

**Examples**

**Get yesterday's date**

```
SELECT yesterday();
SELECT today() - 1;
```

```
┌─yesterday()─┐
│  2025-06-09 │
└─────────────┘
┌─minus(today(), 1)─┐
│        2025-06-09 │
└───────────────────┘
```

- [UTCTimestamp](#UTCTimestamp)- [YYYYMMDDToDate](#YYYYMMDDToDate)- [YYYYMMDDToDate32](#YYYYMMDDToDate32)- [YYYYMMDDhhmmssToDateTime](#YYYYMMDDhhmmssToDateTime)- [YYYYMMDDhhmmssToDateTime64](#YYYYMMDDhhmmssToDateTime64)- [addDate](#addDate)- [addDays](#addDays)- [addHours](#addHours)- [addInterval](#addInterval)- [addMicroseconds](#addMicroseconds)- [addMilliseconds](#addMilliseconds)- [addMinutes](#addMinutes)- [addMonths](#addMonths)- [addNanoseconds](#addNanoseconds)- [addQuarters](#addQuarters)- [addSeconds](#addSeconds)- [addTupleOfIntervals](#addTupleOfIntervals)- [addWeeks](#addWeeks)- [addYears](#addYears)- [age](#age)- [changeDay](#changeDay)- [changeHour](#changeHour)- [changeMinute](#changeMinute)- [changeMonth](#changeMonth)- [changeSecond](#changeSecond)- [changeYear](#changeYear)- [dateDiff](#dateDiff)- [dateName](#dateName)- [dateTrunc](#dateTrunc)- [formatDateTime](#formatDateTime)- [formatDateTimeInJodaSyntax](#formatDateTimeInJodaSyntax)- [fromDaysSinceYearZero](#fromDaysSinceYearZero)- [fromDaysSinceYearZero32](#fromDaysSinceYearZero32)- [fromModifiedJulianDay](#fromModifiedJulianDay)- [fromModifiedJulianDayOrNull](#fromModifiedJulianDayOrNull)- [fromUTCTimestamp](#fromUTCTimestamp)- [fromUnixTimestamp](#fromUnixTimestamp)- [fromUnixTimestampInJodaSyntax](#fromUnixTimestampInJodaSyntax)- [makeDate](#makeDate)- [makeDate32](#makeDate32)- [makeDateTime](#makeDateTime)- [makeDateTime64](#makeDateTime64)- [monthName](#monthName)- [now](#now)- [now64](#now64)- [nowInBlock](#nowInBlock)- [nowInBlock64](#nowInBlock64)- [serverTimezone](#serverTimezone)- [subDate](#subDate)- [subtractDays](#subtractDays)- [subtractHours](#subtractHours)- [subtractInterval](#subtractInterval)- [subtractMicroseconds](#subtractMicroseconds)- [subtractMilliseconds](#subtractMilliseconds)- [subtractMinutes](#subtractMinutes)- [subtractMonths](#subtractMonths)- [subtractNanoseconds](#subtractNanoseconds)- [subtractQuarters](#subtractQuarters)- [subtractSeconds](#subtractSeconds)- [subtractTupleOfIntervals](#subtractTupleOfIntervals)- [subtractWeeks](#subtractWeeks)- [subtractYears](#subtractYears)- [timeDiff](#timeDiff)- [timeSlot](#timeSlot)- [timeSlots](#timeSlots)- [timestamp](#timestamp)- [timezone](#timezone)- [timezoneOf](#timezoneOf)- [timezoneOffset](#timezoneOffset)- [toDayOfMonth](#toDayOfMonth)- [toDayOfWeek](#toDayOfWeek)- [toDayOfYear](#toDayOfYear)- [toDaysInMonth](#toDaysInMonth)- [toDaysSinceYearZero](#toDaysSinceYearZero)- [toHour](#toHour)- [toISOWeek](#toISOWeek)- [toISOYear](#toISOYear)- [toLastDayOfMonth](#toLastDayOfMonth)- [toLastDayOfWeek](#toLastDayOfWeek)- [toMillisecond](#toMillisecond)- [toMinute](#toMinute)- [toModifiedJulianDay](#toModifiedJulianDay)- [toModifiedJulianDayOrNull](#toModifiedJulianDayOrNull)- [toMonday](#toMonday)- [toMonth](#toMonth)- [toMonthNumSinceEpoch](#toMonthNumSinceEpoch)- [toQuarter](#toQuarter)- [toRelativeDayNum](#toRelativeDayNum)- [toRelativeHourNum](#toRelativeHourNum)- [toRelativeMinuteNum](#toRelativeMinuteNum)- [toRelativeMonthNum](#toRelativeMonthNum)- [toRelativeQuarterNum](#toRelativeQuarterNum)- [toRelativeSecondNum](#toRelativeSecondNum)- [toRelativeWeekNum](#toRelativeWeekNum)- [toRelativeYearNum](#toRelativeYearNum)- [toSecond](#toSecond)- [toStartOfDay](#toStartOfDay)- [toStartOfFifteenMinutes](#toStartOfFifteenMinutes)- [toStartOfFiveMinutes](#toStartOfFiveMinutes)- [toStartOfHour](#toStartOfHour)- [toStartOfISOYear](#toStartOfISOYear)- [toStartOfInterval](#toStartOfInterval)- [toStartOfMicrosecond](#toStartOfMicrosecond)- [toStartOfMillisecond](#toStartOfMillisecond)- [toStartOfMinute](#toStartOfMinute)- [toStartOfMonth](#toStartOfMonth)- [toStartOfNanosecond](#toStartOfNanosecond)- [toStartOfQuarter](#toStartOfQuarter)- [toStartOfSecond](#toStartOfSecond)- [toStartOfTenMinutes](#toStartOfTenMinutes)- [toStartOfWeek](#toStartOfWeek)- [toStartOfYear](#toStartOfYear)- [toTimeWithFixedDate](#toTimeWithFixedDate)- [toTimezone](#toTimezone)- [toUTCTimestamp](#toUTCTimestamp)- [toUnixTimestamp](#toUnixTimestamp)- [toWeek](#toWeek)- [toYYYYMM](#toYYYYMM)- [toYYYYMMDD](#toYYYYMMDD)- [toYYYYMMDDhhmmss](#toYYYYMMDDhhmmss)- [toYear](#toYear)- [toYearNumSinceEpoch](#toYearNumSinceEpoch)- [toYearWeek](#toYearWeek)- [today](#today)- [yesterday](#yesterday)

Was this page helpful?