Skip to content

Commit

Permalink
Merge pull request ClickHouse#70160 from yariks5s/to_start_of_interva…
Browse files Browse the repository at this point in the history
…l_docs_fix

Small docs fix
  • Loading branch information
yariks5s authored Oct 1, 2024
2 parents 5257422 + 2f4518f commit 2b293f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions docs/en/sql-reference/functions/date-time-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1623,23 +1623,22 @@ If unit `WEEK` was specified, `toStartOfInterval` assumes that weeks start on Mo
toStartOfInterval(value, INTERVAL x unit[, time_zone])
toStartOfInterval(value, INTERVAL x unit[, origin[, time_zone]])
```
Aliases: `time_bucket`, `date_bin`.

The second overload emulates TimescaleDB's `time_bucket()` function, respectively PostgreSQL's `date_bin()` function, e.g.

``` SQL
SELECT toStartOfInterval(toDateTime('2023-01-01 14:45:00'), INTERVAL 1 MINUTE, toDateTime('2023-01-01 14:35:30'));
```

result:
Result:

``` reference
┌───toStartOfInterval(...)─┐
│ 2023-01-01 14:44:30 │
└──────────────────────────┘
```

Aliases: `time_bucket`, `date_bin`.

**See Also**
- [date_trunc](#date_trunc)

Expand Down
3 changes: 1 addition & 2 deletions docs/ru/sql-reference/functions/date-time-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ WITH toDateTime64('2020-01-01 10:20:30.999', 3) AS dt64 SELECT toStartOfSecond(d
toStartOfInterval(value, INTERVAL x unit[, time_zone])
toStartOfInterval(value, INTERVAL x unit[, origin[, time_zone]])
```
Синонимы: `time_bucket`, `date_bin`.

Вторая перегрузка эмулирует функцию `time_bucket()` из TimescaleDB, и функцию `date_bin()` из PostgreSQL, например:

Expand All @@ -510,8 +511,6 @@ SELECT toStartOfInterval(toDateTime('2023-01-01 14:45:00'), INTERVAL 1 MINUTE, t
└──────────────────────────┘
```

Синонимы: `time_bucket`, `date_bin`.

**См. также**
- [date_trunc](#date_trunc)

Expand Down

0 comments on commit 2b293f6

Please sign in to comment.