mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Update example for date and time operator
Co-authored-by: Nikolai Kochetov <KochetovNicolai@users.noreply.github.com>
This commit is contained in:
parent
09ba2af5dc
commit
cf2c3ee0d8
@ -197,13 +197,16 @@ You can work with dates without using `INTERVAL`, just by adding or subtracting
|
||||
Examples:
|
||||
|
||||
``` sql
|
||||
SELECT now() AS current_date_time, current_date_time + 60*60*96;
|
||||
SELECT
|
||||
toDateTime('2014-10-26 00:00:00', 'Europe/Moscow') AS time,
|
||||
time + 60 * 60 * 24 AS time_plus_24_hours,
|
||||
time + toIntervalDay(1) AS time_plus_1_day
|
||||
```
|
||||
|
||||
``` text
|
||||
┌───current_date_time─┬─plus(now(), multiply(multiply(60, 60), 96))─┐
|
||||
│ 2021-06-12 17:34:49 │ 2021-06-16 17:34:49 │
|
||||
└─────────────────────┴─────────────────────────────────────────────┘
|
||||
┌────────────────time─┬──time_plus_24_hours─┬─────time_plus_1_day─┐
|
||||
│ 2014-10-26 00:00:00 │ 2014-10-26 23:00:00 │ 2014-10-27 00:00:00 │
|
||||
└─────────────────────┴─────────────────────┴─────────────────────┘
|
||||
```
|
||||
|
||||
**See Also**
|
||||
|
@ -197,13 +197,16 @@ SELECT now() AS current_date_time, current_date_time + INTERVAL '4' day + INTERV
|
||||
Пример:
|
||||
|
||||
``` sql
|
||||
SELECT now() AS current_date_time, current_date_time + 60*60*96;
|
||||
SELECT
|
||||
toDateTime('2014-10-26 00:00:00', 'Europe/Moscow') AS time,
|
||||
time + 60 * 60 * 24 AS time_plus_24_hours,
|
||||
time + toIntervalDay(1) AS time_plus_1_day
|
||||
```
|
||||
|
||||
``` text
|
||||
┌───current_date_time─┬─plus(now(), multiply(multiply(60, 60), 96))─┐
|
||||
│ 2021-06-12 17:34:49 │ 2021-06-16 17:34:49 │
|
||||
└─────────────────────┴─────────────────────────────────────────────┘
|
||||
┌────────────────time─┬──time_plus_24_hours─┬─────time_plus_1_day─┐
|
||||
│ 2014-10-26 00:00:00 │ 2014-10-26 23:00:00 │ 2014-10-27 00:00:00 │
|
||||
└─────────────────────┴─────────────────────┴─────────────────────┘
|
||||
```
|
||||
|
||||
**Смотрите также**
|
||||
|
Loading…
Reference in New Issue
Block a user